3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ "key 1" => ['more data' ], "key 2" => [ 'even more data' ], "key 3" => [ 'some data' ], "key 4" => [ 'where is the data' ] ]; $key = 'key 3'; $moved = move_to_first_in_array($array , 'key 3'); print_r($moved); function move_to_first_in_array($array, $key) { return [$key => $array[$key]] + $array; }
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [key 3] => Array ( [0] => some data ) [key 1] => Array ( [0] => more data ) [key 2] => Array ( [0] => even more data ) [key 4] => Array ( [0] => where is the data ) )

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:
36.06 ms | 406 KiB | 5 Q