3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Everything you enter here will be executed by our servers. Try it! $array = array( "id1" => array("unique" => 3), "id2" => array("unique" => 5), "id3" => array("unique" => 1), ); usort($array, function ($a, $b){ if ($a['unique'] == $b) { return 0; } return ($a['unique'] < $a['unique']) ? -1 : 1; }); print_r($array);
Output for 7.0.0 - 7.1.0
Array ( [0] => Array ( [unique] => 5 ) [1] => Array ( [unique] => 1 ) [2] => Array ( [unique] => 3 ) )
Output for hhvm-3.10.0 - 3.12.0
Array ( [0] => Array ( [unique] => 1 ) [1] => Array ( [unique] => 5 ) [2] => Array ( [unique] => 3 ) )
Output for 5.3.0 - 5.6.28
Array ( [0] => Array ( [unique] => 3 ) [1] => Array ( [unique] => 5 ) [2] => Array ( [unique] => 1 ) )
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/4Y0tI on line 13
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/4Y0tI on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/4Y0tI on line 13
Process exited with code 255.