3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s1 = '{ "b": "b", "2": "2", "3": "a", "4": "4", "6": "5", "7": "6" }'; $s2 = '{ "21": "b", "2": "2", "3": "3", "4": "4", "6": "5", "7": "6" }'; $e1 = json_decode($s1,true); $e2 = json_decode($s2,true); function custom_splice(&$ar, $a, $b){ $out = array_splice($ar, $a, 1); array_splice($ar, $b, 0, $out); } function moveElement(&$array, $a, $b) { $keys = array_keys($array); custom_splice($array, $a, $b); custom_splice($keys, $a, $b); $array = array_combine($keys,$array); } moveElement($e1, 2, 0); moveElement($e2, 2, 0); print_r($e1); print_r($e2);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [3] => a [b] => b [2] => 2 [4] => 4 [6] => 5 [7] => 6 ) Array ( [3] => 3 [21] => b [2] => 2 [4] => 4 [6] => 5 [7] => 6 )

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:
118.27 ms | 405 KiB | 5 Q