3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = array(); $arr['i1'] = 99; $arr['i2'] = 89; function cmp($a, $b) { if ($GLOBALS['arr'][$a] > $GLOBALS['arr'][$b]) { return 1; } if ($GLOBALS['arr'][$a] < $GLOBALS['arr'][$b]) { return -1; } return 0; } if (uksort($arr, 'cmp')) { echo "success"; } else { echo "failure"; } print_r($arr);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
successArray ( [i2] => 89 [i1] => 99 )