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 mb_parse_str($query); 22 var_dump($foo); 23 var_dump($bar); 24} 25foreach ($queries as $query) { 26 test($query); 27} 28?> 29--EXPECTF-- 30array(2) { 31 ["foo"]=> 32 string(3) "abc" 33 ["bar"]=> 34 string(3) "def" 35} 36string(0) "" 37string(0) "" 38 39Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d 40string(3) "abc" 41string(3) "def" 42array(2) { 43 ["+foo"]=> 44 string(3) "def" 45 ["-bar"]=> 46 string(3) "jkl" 47} 48string(0) "" 49string(0) "" 50 51Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d 52string(0) "" 53string(0) "" 54array(2) { 55 ["foo"]=> 56 array(3) { 57 [0]=> 58 string(3) "abc" 59 [1]=> 60 string(3) "def" 61 [2]=> 62 string(3) "ghi" 63 } 64 ["bar"]=> 65 array(1) { 66 [0]=> 67 string(3) "jkl" 68 } 69} 70string(0) "" 71string(0) "" 72 73Deprecated: mb_parse_str(): Calling mb_parse_str() without the result argument is deprecated in %s on line %d 74array(3) { 75 [0]=> 76 string(3) "abc" 77 [1]=> 78 string(3) "def" 79 [2]=> 80 string(3) "ghi" 81} 82array(1) { 83 [0]=> 84 string(3) "jkl" 85} 86