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::immediately(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 ArgumentCountError: Too few arguments to function Retry::immediately(), 1 passed in /in/OnbRW on line 52 and exactly 2 expected in /in/OnbRW:12 Stack trace: #0 /in/OnbRW(52): Retry::immediately(Object(Closure)) #1 {main} thrown in /in/OnbRW on line 12
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:
54.2 ms | 401 KiB | 8 Q