3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = array(); $arr['i1']['val1'] = 99; $arr['i1']['val2'] = 100; $arr['i2']['val1'] = 89; $arr['i2']['val2'] = 101; function cmp($a, $b) { global $arr; if ($arr[$a]['val2'] > $arr[$b]['val2']) { return 1; } if ($arr[$q]['val2'] < $arr[$b]['val2']) { return -1; } return 0; } if (uksort($arr, 'cmp')) { echo "success"; } else { echo "failure"; }
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: q in /in/7gus1 on line 16 Notice: Undefined index: in /in/7gus1 on line 16 success
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined index: in /in/7gus1 on line 16 success
Output for 5.2.12 - 5.2.17, 5.3.2 - 5.6.28
Warning: uksort(): Array was modified by the user comparison function in /in/7gus1 on line 20 failure
Output for 4.3.0 - 5.2.11, 5.3.0 - 5.3.1
success