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