3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['parent 1', '10000', '20000'], ['parent 1', '15000', '21000'], ['parent 2', '13000', '22000'], ['parent 2', '11000', '5000'], ]; $new_array = array(); foreach($array as $a) { $temp = array_slice($a, 1); if(!array_key_exists($a[0], $new_array)) { $new_array[$a[0]] = array(); } array_push($new_array[$a[0]], $temp); } print_r($new_array) ?>
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [parent 1] => Array ( [0] => Array ( [0] => 10000 [1] => 20000 ) [1] => Array ( [0] => 15000 [1] => 21000 ) ) [parent 2] => Array ( [0] => Array ( [0] => 13000 [1] => 22000 ) [1] => Array ( [0] => 11000 [1] => 5000 ) ) )

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:
124.21 ms | 407 KiB | 5 Q