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 RetriesExceededException(); } } class Test { public function doSomething() { throw new \Exception(); } } $test = new Test(); try { Retry::immediately(function() use ($test) { $test->doSomething(); }, 5); } 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)
8.3.60.0090.00916.75
8.3.50.0110.00521.08
8.3.40.0070.00718.84
8.3.30.0090.00618.63
8.3.20.0040.00420.34
8.3.10.0050.00223.66
8.3.00.0000.00823.60
8.2.180.0120.00316.88
8.2.170.0110.00422.96
8.2.160.0150.00321.88
8.2.150.0040.00424.18
8.2.140.0020.00524.66
8.2.130.0000.00826.16
8.2.120.0090.00017.75
8.2.110.0080.00319.21
8.2.100.0030.00917.50
8.2.90.0050.00319.17
8.2.80.0000.00817.97
8.2.70.0000.00917.75
8.2.60.0030.00617.80
8.2.50.0040.00418.07
8.2.40.0060.00321.18
8.2.30.0030.00519.86
8.2.20.0040.00417.68
8.2.10.0000.00818.18
8.2.00.0060.00317.94
8.1.280.0170.00325.92
8.1.270.0050.00320.32
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0050.00522.72
8.1.230.0120.00017.75
8.1.220.0040.00417.74
8.1.210.0030.00518.77
8.1.200.0040.00417.35
8.1.190.0000.00817.35
8.1.180.0050.00318.10
8.1.170.0030.00518.71
8.1.160.0070.00022.13
8.1.150.0040.00418.78
8.1.140.0080.00017.38
8.1.130.0000.00717.63
8.1.120.0030.00517.48
8.1.110.0040.00417.39
8.1.100.0000.00717.38
8.1.90.0040.00417.36
8.1.80.0040.00417.46
8.1.70.0070.00017.52
8.1.60.0080.00017.62
8.1.50.0030.00617.44
8.1.40.0060.00317.53
8.1.30.0000.01017.64
8.1.20.0000.00717.57
8.1.10.0040.00417.59
8.1.00.0000.00817.54
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0050.00218.42
8.0.270.0000.00717.32
8.0.260.0000.00617.27
8.0.250.0030.00517.07
8.0.240.0030.00316.88
8.0.230.0030.00516.91
8.0.220.0030.00316.98
8.0.210.0000.00817.04
8.0.200.0000.00717.04
8.0.190.0040.00417.00
8.0.180.0000.00717.00
8.0.170.0000.00817.01
8.0.160.0030.00317.05
8.0.150.0000.00717.02
8.0.140.0090.00017.00
8.0.130.0060.00013.41
8.0.120.0060.00316.85
8.0.110.0060.00316.80
8.0.100.0040.00416.87
8.0.90.0070.00016.98
8.0.80.0070.01617.04
8.0.70.0080.00016.99
8.0.60.0040.00416.99
8.0.50.0070.00016.89
8.0.30.0060.01117.16
8.0.20.0080.01017.40
8.0.10.0000.00716.98
8.0.00.0100.01016.71
7.4.330.0030.00315.14
7.4.320.0060.00016.60
7.4.300.0000.00616.50
7.4.290.0040.00416.45
7.4.280.0000.00716.40
7.4.270.0080.00016.38
7.4.260.0030.00316.63
7.4.250.0070.00016.40
7.4.240.0060.00216.49
7.4.230.0000.00716.36
7.4.220.0130.00316.55
7.4.210.0070.00816.64
7.4.200.0070.00016.43
7.4.160.0080.00816.65
7.4.150.0150.00917.40
7.4.140.0110.01017.86
7.4.130.0080.00916.66
7.4.120.0080.01016.41
7.4.110.0130.00716.70
7.4.100.0120.00616.63
7.4.90.0090.00816.61
7.4.80.0150.00719.39
7.4.70.0080.00816.50
7.4.60.0070.01016.39
7.4.50.0040.00416.59
7.4.40.0100.00616.59
7.4.30.0070.01416.64
7.4.00.0040.01315.12
7.3.330.0000.00613.49
7.3.320.0030.00313.53
7.3.310.0000.00716.28
7.3.300.0030.00316.53
7.3.290.0070.01116.41
7.3.280.0070.01016.45
7.3.270.0070.01117.40
7.3.260.0070.01016.39
7.3.250.0090.00716.50
7.3.240.0100.00716.63
7.3.230.0090.00916.55
7.3.210.0060.01016.52
7.3.200.0110.00616.73
7.3.190.0060.00916.62
7.3.180.0200.00316.38
7.3.170.0060.01016.51
7.3.160.0170.00016.66
7.3.120.0090.00914.81
7.3.110.0060.01314.94
7.3.100.0060.00814.77
7.3.90.0140.00014.92
7.3.80.0000.01814.92
7.3.70.0110.00314.67
7.3.60.0130.00014.93
7.3.50.0030.01515.00
7.3.40.0060.00614.65
7.3.30.0060.00614.93
7.3.20.0070.00716.76
7.3.10.0080.00516.81
7.3.00.0040.00916.60
7.2.330.0030.01316.59
7.2.320.0130.01016.45
7.2.310.0060.01216.60
7.2.300.0070.01016.75
7.2.290.0070.01116.87
7.2.250.0090.00615.02
7.2.240.0040.01815.31
7.2.230.0040.01115.02
7.2.220.0120.00415.16
7.2.210.0100.00715.01
7.2.200.0030.00915.11
7.2.190.0030.01414.95
7.2.180.0120.00615.23
7.2.170.0030.01215.07
7.2.130.0050.00516.67
7.2.120.0030.00916.99
7.2.110.0000.01116.60
7.2.100.0040.00717.02
7.2.90.0040.00817.00
7.2.80.0000.00916.88
7.2.70.0070.00416.97
7.2.60.0020.01216.82
7.2.50.0070.00717.14
7.2.40.0000.01017.05
7.2.30.0100.00316.83
7.2.20.0030.01017.00
7.2.10.0030.00916.95
7.2.00.0010.01118.28
7.1.330.0080.00415.75
7.1.320.0090.00615.74
7.1.310.0060.00615.77
7.1.300.0040.01416.01
7.1.290.0000.01415.66
7.1.280.0060.00915.63
7.1.270.0030.01315.97
7.1.260.0110.00315.58
7.1.250.0000.01315.91
7.1.200.0000.00915.47
7.1.70.0040.00417.30
7.1.60.0070.00317.22
7.1.50.0130.00716.99
7.1.00.0000.08022.36
7.0.200.0040.00416.84
7.0.60.0170.06319.80
7.0.50.0030.08717.88
7.0.40.0100.08020.30
7.0.30.0330.07320.11
7.0.20.0200.04020.26
7.0.10.0100.08320.30
7.0.00.0000.04720.29
5.6.280.0070.04021.03
5.6.210.0070.08320.52
5.6.200.0030.06018.25
5.6.190.0170.04720.60
5.6.180.0430.05020.33
5.6.170.0200.04020.44
5.6.160.0030.04320.48
5.6.150.0070.08318.18
5.6.140.0030.07318.16
5.6.130.0070.08318.23
5.6.120.0070.06321.02
5.6.110.0030.08021.03
5.6.100.0130.04020.97
5.6.90.0270.06321.00
5.6.80.0070.08320.42
5.5.350.0300.06320.45
5.5.340.0070.06317.99
5.5.330.0030.05320.19
5.5.320.0470.05020.27
5.5.310.0530.07320.35
5.5.300.0030.06717.96
5.5.290.0070.08318.01
5.5.280.0000.05020.82
5.5.270.0030.08320.80
5.5.260.0130.06320.88
5.5.250.0130.07320.68
5.5.240.0030.06720.21
5.4.450.0030.08019.64
5.4.440.0030.07019.47
5.4.430.0070.07719.55
5.4.420.0070.08019.32
5.4.410.0030.08019.42
5.4.400.0030.07719.10
5.4.390.0030.07718.87
5.4.380.0000.05019.22
5.4.370.0030.06719.09
5.4.360.0030.07719.09
5.4.350.0100.04719.15
5.4.340.0170.04318.88
5.4.320.0100.07318.98
5.4.310.0030.07719.24
5.4.300.0030.07019.31
5.4.290.0070.05719.09
5.4.280.0030.05318.98
5.4.270.0000.04719.05
5.4.260.0200.04319.16
5.4.250.0030.06019.08
5.4.240.0000.05319.30
5.4.230.0000.08018.98
5.4.220.0170.06319.15
5.4.210.0030.07719.29
5.4.200.0070.07019.21
5.4.190.0070.06018.98
5.4.180.0070.07719.05
5.4.170.0030.05019.21
5.4.160.0030.05718.96
5.4.150.0070.04719.11
5.4.140.0030.07016.34
5.4.130.0030.07316.41
5.4.120.0030.06016.42
5.4.110.0030.04316.42
5.4.100.0000.07316.50
5.4.90.0030.07016.34
5.4.80.0030.06016.57
5.4.70.0030.03716.59
5.4.60.0030.05316.54
5.4.50.0030.03716.43
5.4.40.0030.06316.18
5.4.30.0000.06716.37
5.4.20.0030.05016.54
5.4.10.0070.07316.52
5.4.00.0030.04015.81
5.3.290.0070.06714.82
5.3.280.0070.05014.82
5.3.270.0030.05714.82
5.3.260.0070.06714.82
5.3.250.0000.08014.85
5.3.240.0030.07314.82
5.3.230.0030.07314.84
5.3.220.0030.07314.82
5.3.210.0070.07314.82
5.3.200.0000.04714.82
5.3.190.0030.04714.82
5.3.180.0000.05314.82
5.3.170.0070.05714.82
5.3.160.0030.07314.82
5.3.150.0100.03014.82
5.3.140.0000.04314.82
5.3.130.0030.06314.82
5.3.120.0000.06714.82
5.3.110.0030.05714.82
5.3.100.0000.08014.82
5.3.90.0070.06714.82
5.3.80.0030.07314.82
5.3.70.0000.06314.82
5.3.60.0000.07014.82
5.3.50.0070.07014.82
5.3.40.0070.07014.82
5.3.30.0030.06714.82
5.3.20.0030.07014.82
5.3.10.0070.06314.82
5.3.00.0030.05314.82
5.2.170.0000.06314.82
5.2.160.0030.06314.82
5.2.150.0000.05714.82
5.2.140.0030.06014.82
5.2.130.0030.05714.82
5.2.120.0030.06014.82
5.2.110.0070.05314.82
5.2.100.0030.03014.82
5.2.90.0070.06014.82
5.2.80.0000.06714.82
5.2.70.0000.06314.82
5.2.60.0000.06314.82
5.2.50.0030.03014.82
5.2.40.0030.03714.82
5.2.30.0030.06314.82
5.2.20.0000.05714.82
5.2.10.0000.04714.82
5.2.00.0070.06014.82
5.1.60.0030.05314.82
5.1.50.0000.04014.82
5.1.40.0000.05314.82
5.1.30.0030.04314.82
5.1.20.0030.05314.82
5.1.10.0000.03714.82
5.1.00.0000.03314.82
5.0.50.0000.02714.82
5.0.40.0000.02714.82
5.0.30.0070.06014.82
5.0.20.0000.04714.82
5.0.10.0000.04014.82
5.0.00.0000.06714.82
4.4.90.0000.03014.82
4.4.80.0030.03314.82
4.4.70.0070.03014.82
4.4.60.0000.03714.82
4.4.50.0030.02314.82
4.4.40.0070.05014.82
4.4.30.0000.03314.82
4.4.20.0030.03014.82
4.4.10.0000.01714.82
4.4.00.0030.04014.82
4.3.110.0000.03714.82
4.3.100.0000.03714.82
4.3.90.0030.03014.82
4.3.80.0000.05314.82
4.3.70.0070.03314.82
4.3.60.0030.02714.82
4.3.50.0030.02714.82
4.3.40.0070.04014.82
4.3.30.0000.02314.82
4.3.20.0000.02714.82
4.3.10.0000.02714.82
4.3.00.0000.02314.82

preferences:
34.5 ms | 401 KiB | 5 Q