3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Job { public function isEarlierThan(Job $other) { try { return rand(0, 10) < 5; } catch (Exception $e) { throw new Exception($other . ' ' . $e->getMessage()); } } } $jobs = array(new Job(), new Job(), new Job()); return rand(0, 10) < 5; usort($jobs, function($j1, $j2) { return $j1->isEarlierThan($j2) ? -1 : 1; });

preferences:
34.81 ms | 402 KiB | 5 Q