3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function cmp($a, $b) { if ($a == $b) { return 0; } echo $b." mukesh "; return ($a < $b) ? -1 : 1; } $a = array(3, 2, 5, 6, 1); usort($a, "cmp"); foreach ($a as $key => $value) { echo "$key: $value\n"; }
based on OI1T8
Output for 7.0.0 - 7.2.0
2 mukesh 2 mukesh 5 mukesh 6 mukesh 1 mukesh 1 mukesh 1 mukesh 1 mukesh 0: 1 1: 2 2: 3 3: 5 4: 6
Output for 5.3.20 - 5.6.28
2 mukesh 3 mukesh 6 mukesh 5 mukesh 1 mukesh 2 mukesh 0: 1 1: 2 2: 3 3: 5 4: 6