3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $l = new StdClass; $l->d = new DateTime('2000-01-02 00:00:00'); $l->name = 'cd'; $m = new StdClass; $m->d = new DateTime('2000-01-01 00:00:00'); $m->name = 'ab'; $n = new StdClass; $n->d = new DateTime('2000-01-01 00:00:00'); $n-name = 'ef'; $result = [$l, $m,$n]; //reorder the campaigns, because the order is not correct between different campaigns. uasort($result, function ($a, $b) { $dateA = $a->d; $dateB = $b->d; if ($dateA == $dateB) { return 0; } return $dateA < $dateB ? 1 : -1; }); var_dump($result);
based on vr0hk
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.1.6
Parse error: syntax error, unexpected '=' in /in/cKADc on line 11
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: syntax error, unexpected '=' in /in/cKADc:11 Stack trace: #0 {main}
Process exited with code 255.