3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = [ 0 => [23, 890], 1 => [56, 401], 2 => [56, 491], 3 => [98, 840], 4 => [56, 821], 5 => [98, 401], 6 => [23, 875], ]; uasort($arr, function ($a, $b) { if( $a[0] != $b[0] ) return $a[0] - $b[0]; else if( strval($a[1])[1] == 9 ) return 1; else return $a[1] - $b[1]; }); print_r($arr);
Output for 5.5.0 - 7.2.0
Array ( [6] => Array ( [0] => 23 [1] => 875 ) [0] => Array ( [0] => 23 [1] => 890 ) [1] => Array ( [0] => 56 [1] => 401 ) [4] => Array ( [0] => 56 [1] => 821 ) [2] => Array ( [0] => 56 [1] => 491 ) [5] => Array ( [0] => 98 [1] => 401 ) [3] => Array ( [0] => 98 [1] => 840 ) )