If you're having a problem converting a query string to an array in joomla

Written by  Thursday, 28 April 2016 20:58

If you're having a problem converting a query string to an array because of encoded ampersands &

// Input string //
$input = 'pg_id=2&parent_id=2&document&video';

// Parse //
parse_str(html_entity_decode($input), $out);

// Output of $out //
array(
  'pg_id' => 2,
  'parent_id' => 2,
  'document' => ,
  'video' =>
)

 

383 Read

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.