3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array ( 'relation' => 'AND', 'key1' => 'Demo', 'value1' => 'demo', 'compare1' => '=', 'type1' => 'NUMERIC', 'key2' => 'test', 'value2' => 'test', 'compare2' => '=', 'type2' => 'NUMERIC', 'key3' => 'test', 'compare3' => '=', 'type3' => 'NUMERIC', 'key4' => 'test', 'value4' => 'test', 'key5' => 'test', 'value5' => 'test', 'compare5' => '=', 'type5' => 'NUMERIC', ); $new = array_splice($arr, 0,1); foreach($arr as $k => $v){ preg_match("/(.*?)(\d+)/", $k, $m); $new[$m[2]-1][$m[1]] = $v; } var_export($new);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'relation' => 'AND', 0 => array ( 'key' => 'Demo', 'value' => 'demo', 'compare' => '=', 'type' => 'NUMERIC', ), 1 => array ( 'key' => 'test', 'value' => 'test', 'compare' => '=', 'type' => 'NUMERIC', ), 2 => array ( 'key' => 'test', 'compare' => '=', 'type' => 'NUMERIC', ), 3 => array ( 'key' => 'test', 'value' => 'test', ), 4 => array ( 'key' => 'test', 'value' => 'test', 'compare' => '=', 'type' => 'NUMERIC', ), )

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