3v4l.org

run code in 300+ PHP versions simultaneously
<?php class RetriesExceededException extends \Exception {} class Retry { static public function withDelay(callable $fn, $retries, $delay) { return self::execute($fn, $retries, $delay); } static public function immediately(callable $fn, $retries) { return self::execute($fn, $retries); } static private function execute(callable $fn, $retries, $delay = null) { while ($retries) { $retries--; try { return $fn; } catch (Exception $e) { if ($retries && $delay) { //do delay } } } throw new RetriesExceededException(); } } class Test { public function exception() { throw \Exception(); } } $test = new Test(); try { Retry::immediate(function() use ($test) { $test->exception(); }); } catch (Exception $e) { var_dump($e); } //Retry::withDelay($fn, $retries, $delay); //Retry::immediately($fn, $retries);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined method Retry::immediate() in /in/lgDmv:52 Stack trace: #0 {main} thrown in /in/lgDmv on line 52
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
64.76 ms | 401 KiB | 8 Q