3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function cmp($a, $b) { if ($a == $b) { return 0; } echo $a." mukesh " . $b . "\n"; 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 HQlJm
Output for 7.0.0 - 7.2.0
3 mukesh 2 5 mukesh 2 3 mukesh 5 5 mukesh 6 6 mukesh 1 5 mukesh 1 3 mukesh 1 2 mukesh 1 0: 1 1: 2 2: 3 3: 5 4: 6
Output for 5.3.20 - 5.6.28
5 mukesh 2 5 mukesh 3 5 mukesh 6 1 mukesh 5 2 mukesh 1 3 mukesh 2 0: 1 1: 2 2: 3 3: 5 4: 6