3v4l.org

run code in 300+ PHP versions simultaneously
<?php function parseIt($input){ parse_str(preg_replace ("/\s+(\w+\[?\]?)=/", "&$1=", $input), $output); $return = []; foreach ($output as $key => $value){ $value = preg_replace('/^"(.+)"$/', "$1", $value); $return[$key] = $value; } return $return; } $inputs[] = 'i=prd33 foo="really long value"'; $inputs[] = '1=prd33,prd22,prd44 foo="something " else with internal quotes"'; $inputs[] = '1=prd33,prd22,prd44 foo="something \' else with internal quotes\'"'; $inputs[] = 'i[]=prd33 foo="hah" i[]=prd32 bar="neener" i[]=prd31'; foreach ($inputs as $input){ print_r(parseIt($input)); }
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [i] => prd33 [foo] => really long value ) Array ( [1] => prd33,prd22,prd44 [foo] => something " else with internal quotes ) Array ( [1] => prd33,prd22,prd44 [foo] => something ' else with internal quotes' ) Array ( [i] => Array ( [0] => prd33 [1] => prd32 [2] => prd31 ) [foo] => hah [bar] => neener )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
63.99 ms | 402 KiB | 8 Q