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() { thrown new \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);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.6.120.0070.04320.90
5.6.110.0000.05320.98
5.6.100.0130.07721.13
5.6.90.0070.05320.89
5.6.80.0070.08020.42
5.5.280.0000.06720.70
5.5.270.0130.08320.80
5.5.260.0130.06020.81
5.5.250.0130.05720.70
5.5.240.0130.07720.28
5.4.440.0670.06019.63
5.4.430.0730.05319.15
5.4.420.0800.04719.70
5.4.410.0770.07319.04
5.4.400.0670.05319.01
5.4.390.0570.06319.14
5.4.380.0670.04719.26
5.4.370.0530.05719.23
5.4.360.0830.04318.84
5.4.350.0570.05719.12
5.4.340.0630.05318.85
5.4.320.0600.06319.06
5.4.310.0530.05019.20
5.4.300.0570.05319.30
5.4.290.0530.05719.06
5.4.280.0770.04718.84
5.4.270.0870.05019.09
5.4.260.0600.04719.13
5.4.250.0730.04319.10
5.4.240.0730.06719.26
5.4.230.0700.05319.16
5.4.220.0730.04718.95
5.4.210.0570.04719.18
5.4.200.0630.05316.95
5.4.190.0700.05019.00
5.4.180.0700.05319.27
5.4.170.0470.05719.18
5.4.160.0630.05019.16
5.4.150.0570.05019.06
5.4.140.0670.05716.49
5.4.130.0530.06016.61
5.4.120.0670.05716.38
5.4.110.0600.05316.60
5.4.100.0500.06716.46
5.4.90.0530.05716.46
5.4.80.0170.06716.42
5.4.70.0170.04316.54
5.4.60.0270.04716.54
5.4.50.0600.04716.53
5.4.40.0430.05016.46
5.4.30.0200.05016.40
5.4.20.0200.04716.36
5.4.10.0530.05716.48
5.4.00.0630.05015.86
5.3.290.0570.06014.61
5.3.280.0500.05714.75
5.3.270.0630.05714.73
5.3.260.0470.05714.75
5.3.250.0500.05314.59
5.3.240.0530.05314.56
5.3.230.0530.05314.76
5.3.220.0670.05014.80
5.3.210.0630.06714.73
5.3.200.0570.05014.56
5.3.190.0570.05014.56
5.3.180.0270.04714.65
5.3.170.0170.06314.50
5.3.160.0030.05714.87
5.3.150.0570.08314.79
5.3.140.0670.05714.63
5.3.130.0470.07314.46
5.3.120.0330.06014.64
5.3.110.0300.06714.67
5.3.100.0730.05314.14
5.3.90.0630.05314.12
5.3.80.0770.05314.00
5.3.70.0600.05014.00
5.3.60.0700.04714.15
5.3.50.0570.04713.95
5.3.40.0370.05313.94
5.3.30.0100.05014.00
5.3.20.0100.04713.91
5.3.10.0170.04313.75
5.3.00.0670.04013.64
5.2.170.0500.03711.07
5.2.160.0400.04711.32
5.2.150.0330.04311.08
5.2.140.0070.04311.07
5.2.130.0000.04711.04
5.2.120.0000.04711.14
5.2.110.0500.03711.34
5.2.100.0670.04711.29
5.2.90.0800.05311.13
5.2.80.0570.04311.02
5.2.70.0530.04311.13
5.2.60.0530.04010.98
5.2.50.0630.03310.94
5.2.40.0500.03710.94
5.2.30.0430.04310.90
5.2.20.0430.04010.95
5.2.10.0570.05310.89
5.2.00.0430.04010.79
5.1.60.0530.0279.94
5.1.50.0500.02710.00
5.1.40.0500.0409.91
5.1.30.0530.03310.23
5.1.20.0370.03710.28
5.1.10.0500.04710.02
5.1.00.0400.04010.17
5.0.50.0300.0238.79
5.0.40.0200.0308.27
5.0.30.0270.0408.25
5.0.20.0170.0308.25
5.0.10.0300.0278.25
5.0.00.0170.0438.25
4.4.90.0270.0178.25
4.4.80.0200.0238.25
4.4.70.0230.0208.25
4.4.60.0170.0308.25
4.4.50.0200.0208.25
4.4.40.0230.0478.25
4.4.30.0230.0208.25
4.4.20.0270.0208.25
4.4.10.0230.0238.25
4.4.00.0300.0408.25
4.3.110.0200.0278.25
4.3.100.0200.0208.25
4.3.90.0170.0208.25
4.3.80.0170.0378.25
4.3.70.0230.0178.25
4.3.60.0200.0178.25
4.3.50.0170.0208.25
4.3.40.0200.0338.25
4.3.30.0100.0278.25
4.3.20.0130.0208.25
4.3.10.0100.0238.25
4.3.00.0000.0237.24

preferences:
138.7 ms | 1394 KiB | 7 Q