1--TEST-- 2mb_parse_str() 3--SKIPIF-- 4<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> 5--INI-- 6arg_separator.input=& 7register_globals=0 8--FILE-- 9<?php 10$queries = array( 11 "foo=abc&bar=def", 12 "%2bfoo=def&-bar=jkl", 13 "foo[]=abc&foo[]=def&foo[]=ghi&bar[]=jkl" 14); 15function test($query) { 16 $foo = ''; 17 $bar = ''; 18 mb_parse_str($query, $array); 19 var_dump($array); 20 var_dump($foo); 21 var_dump($bar); 22 mb_parse_str($query); 23 var_dump($foo); 24 var_dump($bar); 25} 26foreach ($queries as $query) { 27 test($query); 28} 29?> 30--EXPECT-- 31array(2) { 32 ["foo"]=> 33 string(3) "abc" 34 ["bar"]=> 35 string(3) "def" 36} 37string(0) "" 38string(0) "" 39string(3) "abc" 40string(3) "def" 41array(2) { 42 ["+foo"]=> 43 string(3) "def" 44 ["-bar"]=> 45 string(3) "jkl" 46} 47string(0) "" 48string(0) "" 49string(0) "" 50string(0) "" 51array(2) { 52 ["foo"]=> 53 array(3) { 54 [0]=> 55 string(3) "abc" 56 [1]=> 57 string(3) "def" 58 [2]=> 59 string(3) "ghi" 60 } 61 ["bar"]=> 62 array(1) { 63 [0]=> 64 string(3) "jkl" 65 } 66} 67string(0) "" 68string(0) "" 69array(3) { 70 [0]=> 71 string(3) "abc" 72 [1]=> 73 string(3) "def" 74 [2]=> 75 string(3) "ghi" 76} 77array(1) { 78 [0]=> 79 string(3) "jkl" 80} 81