3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "[1,1x,1x,1x][2,2x,2x,2x]"; $arr =[]; preg_replace_callback('/\[(.*?)\]/', function($m) use (&$arr){ $arr[] = explode(',',preg_replace('/([\w]+)/', "[$1]", $m[1])); }, $str); print_r($arr); var_dump($arr);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [0] => [1] [1] => [1x] [2] => [1x] [3] => [1x] ) [1] => Array ( [0] => [2] [1] => [2x] [2] => [2x] [3] => [2x] ) ) array(2) { [0]=> array(4) { [0]=> string(3) "[1]" [1]=> string(4) "[1x]" [2]=> string(4) "[1x]" [3]=> string(4) "[1x]" } [1]=> array(4) { [0]=> string(3) "[2]" [1]=> string(4) "[2x]" [2]=> string(4) "[2x]" [3]=> string(4) "[2x]" } }

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:
30.94 ms | 402 KiB | 8 Q