3v4l.org

run code in 300+ PHP versions simultaneously
<?php function uasort_key(&$arr, $func) { return uksort($arr, function($a,$b) use($arr,$func) { return $func($arr[$a], $arr[$b], $a, $b); }); } function sort_me($a, $b, $ka = 0, $kb = 0) { return ($a < $b ? -1 : ($a > $b ? 1 : ($ka < $kb ? -1 : ($ka > $kb ? 1 : 0)) )); } $test_array = array(4,6,2,1,7,5,1,34,1,0,4); $test_array_uasort_key = $test_array; uasort_key($test_array_uasort_key, 'sort_me'); print_r($test_array_uasort_key);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [9] => 0 [3] => 1 [6] => 1 [8] => 1 [2] => 2 [0] => 4 [10] => 4 [5] => 5 [1] => 6 [4] => 7 [7] => 34 )

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:
57.49 ms | 401 KiB | 8 Q