3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $std1 = new stdclass(); $std1->id = 0; $std2 = new stdclass(); $std2->id = 1; $previous = array($std1); $new = array($std1, $std2); function compareThem($a, $b) { $diff = $a->id - $b->id; if ($diff < 0) { return -1; } if ($diff > 0) { return 1; } return 0; }
Output for 4.3.0 - 5.6.25, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0