3v4l.org

run code in 300+ PHP versions simultaneously
<?php $results = [ 1 => 220,0 => 209,4 => 127, 14 => 89, 3 => 84, 7 => 78, 2 => 71, 13 => 61, 16 => 56, 8 => 48, 12 => 45, 10 => 42, 11 => 42, 6 => 39, 5 => 35, 9 => 32, 15 => 22, 17 => 22, 18 => 22, 19 => 1 ]; $anotherArray1 = [11 => 101, 10 => 119]; $anotherArray2 = [17 => 150, 18 => 160, 15 => 179]; $sekArr = array_replace($results,$anotherArray1,$anotherArray2); $newArr = []; foreach($results as $key => $value){ $newArr[$key] = ["v" => $value, 's' => $sekArr[$key]]; } uasort($newArr, function($a,$b){ return $b['v'] <=> $a['v'] ?: $a['s'] <=> $b['s']; }); $results = []; foreach($newArr as $key => $arr){ $results[$key] = $arr['v']; } var_dump($results);
Output for git.master, git.master_jit, rfc.property-hooks
array(20) { [1]=> int(220) [0]=> int(209) [4]=> int(127) [14]=> int(89) [3]=> int(84) [7]=> int(78) [2]=> int(71) [13]=> int(61) [16]=> int(56) [8]=> int(48) [12]=> int(45) [11]=> int(42) [10]=> int(42) [6]=> int(39) [5]=> int(35) [9]=> int(32) [17]=> int(22) [18]=> int(22) [15]=> int(22) [19]=> int(1) }

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