1--TEST-- 2mb_parse_str() test 2 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&fubar=ghi", 11 "%2bfoo=def&-bar=jkl#+fubar", 12 " foo[]=abc&foo[]=def#foo[]=ghi#bar[]=#foo[]&fubar[]==" 13); 14function test($query) { 15 $foo = ''; 16 $bar = ''; 17 $fubar = ''; 18 mb_parse_str($query, $array); 19 var_dump($array); 20 var_dump($foo); 21 var_dump($bar); 22 var_dump($fubar); 23} 24foreach ($queries as $query) { 25 test($query); 26} 27?> 28--EXPECT-- 29array(3) { 30 ["foo"]=> 31 string(3) "abc" 32 ["bar"]=> 33 string(3) "def" 34 ["fubar"]=> 35 string(3) "ghi" 36} 37string(0) "" 38string(0) "" 39string(0) "" 40array(3) { 41 ["+foo"]=> 42 string(3) "def" 43 ["-bar"]=> 44 string(3) "jkl" 45 ["fubar"]=> 46 string(0) "" 47} 48string(0) "" 49string(0) "" 50string(0) "" 51array(3) { 52 ["foo"]=> 53 array(4) { 54 [0]=> 55 string(3) "abc" 56 [1]=> 57 string(3) "def" 58 [2]=> 59 string(3) "ghi" 60 [3]=> 61 string(0) "" 62 } 63 ["bar"]=> 64 array(1) { 65 [0]=> 66 string(0) "" 67 } 68 ["fubar"]=> 69 array(1) { 70 [0]=> 71 string(1) "=" 72 } 73} 74string(0) "" 75string(0) "" 76string(0) "" 77