1--TEST--
2Test parse_str() function : basic functionality
3--FILE--
4<?php
5
6echo "*** Testing parse_str() : basic functionality ***\n";
7
8echo "\nBasic test WITH undefined var for result arg\n";
9$s1 = "first=val1&second=val2&third=val3";
10var_dump(parse_str($s1, $res1));
11var_dump($res1);
12
13echo "\nBasic test WITH existing non-array var for result arg\n";
14$res2 =99;
15$s1 = "first=val1&second=val2&third=val3";
16var_dump(parse_str($s1, $res2));
17var_dump($res2);
18
19echo "\nBasic test with an existing array as results array\n";
20$res3_array = array(1,2,3,4);
21var_dump(parse_str($s1, $res3_array));
22var_dump($res3_array);
23
24?>
25--EXPECT--
26*** Testing parse_str() : basic functionality ***
27
28Basic test WITH undefined var for result arg
29NULL
30array(3) {
31  ["first"]=>
32  string(4) "val1"
33  ["second"]=>
34  string(4) "val2"
35  ["third"]=>
36  string(4) "val3"
37}
38
39Basic test WITH existing non-array var for result arg
40NULL
41array(3) {
42  ["first"]=>
43  string(4) "val1"
44  ["second"]=>
45  string(4) "val2"
46  ["third"]=>
47  string(4) "val3"
48}
49
50Basic test with an existing array as results array
51NULL
52array(3) {
53  ["first"]=>
54  string(4) "val1"
55  ["second"]=>
56  string(4) "val2"
57  ["third"]=>
58  string(4) "val3"
59}
60