3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = [ [1,3,5], [2,1,7], [3,5,9], [2,1,8] ]; $comparison = function ($a,$b) { // sort by index 1 first if($a[1] < $b[1]) return -1; if($a[1] > $b[1]) return 1; // if equal, sort by index 0 if($a[0] < $b[0]) return -1; if($a[0] > $b[0]) return 1; // otherwise sort by index 2 if($a[2] < $b[2]) return -1; if($a[2] > $b[2]) return 1; return 0; }; usort($test,$comparison); var_dump($test);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [0]=> array(3) { [0]=> int(2) [1]=> int(1) [2]=> int(7) } [1]=> array(3) { [0]=> int(2) [1]=> int(1) [2]=> int(8) } [2]=> array(3) { [0]=> int(1) [1]=> int(3) [2]=> int(5) } [3]=> array(3) { [0]=> int(3) [1]=> int(5) [2]=> int(9) } }

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:
32.57 ms | 402 KiB | 8 Q