3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = [1,2,3,4,5,6,1,2,3,4,5,6]; $f = function($a,$b) { return $a < $b ? 1 : -1; }; uasort($a, $f); print_r($a);
based on Qkh0i
Output for 7.0.0 - 7.2.0
Array ( [5] => 6 [11] => 6 [4] => 5 [10] => 5 [3] => 4 [9] => 4 [2] => 3 [8] => 3 [1] => 2 [7] => 2 [0] => 1 [6] => 1 )
Output for 5.4.9 - 5.6.28
Array ( [11] => 6 [5] => 6 [10] => 5 [4] => 5 [9] => 4 [3] => 4 [8] => 3 [2] => 3 [1] => 2 [7] => 2 [6] => 1 [0] => 1 )
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/VWp6q on line 3
Process exited with code 255.