2 Test parse_str() function : basic functionality
6 /* Prototype : void parse_str ( string $str , array &$arr )
7 * Description: Parses the string into variables
8 * Source code: ext/standard/string.c
11 echo "*** Testing parse_str() : basic functionality ***\n";
13 echo "\nBasic test WITH undefined var for result arg\n";
14 $s1 = "first=val1&second=val2&third=val3";
15 var_dump(parse_str($s1, $res1));
18 echo "\nBasic test WITH existing non-array var for result arg\n";
20 $s1 = "first=val1&second=val2&third=val3";
21 var_dump(parse_str($s1, $res2));
24 echo "\nBasic test with an existing array as results array\n";
25 $res3_array = array(1,2,3,4);
26 var_dump(parse_str($s1, $res3_array));
27 var_dump($res3_array);
31 *** Testing parse_str() : basic functionality ***
33 Basic test WITH undefined var for result arg
44 Basic test WITH existing non-array var for result arg
55 Basic test with an existing array as results array