3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rgData = [ 3 => 1, 5 => 0, 1 => 2, 9 => 0, 0 => 1, 4 => 2, 2 => 1, 7 => 0, 6 => 0, 8 => 0, ]; $keys = array_keys($rgData); // Sort the array's keys usort($keys, function($a, $b) use($rgData){ $aVal = $rgData[$a]; $bVal = $rgData[$b]; // Compare the values if($aVal === $bVal){ // If they are the same, compare the keys return $a - $b; } // Otherwise compare the values return $aVal - $bVal; }); var_dump($rgData);
Output for git.master, git.master_jit, rfc.property-hooks
array(10) { [3]=> int(1) [5]=> int(0) [1]=> int(2) [9]=> int(0) [0]=> int(1) [4]=> int(2) [2]=> int(1) [7]=> int(0) [6]=> int(0) [8]=> int(0) }

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