3v4l.org

run code in 300+ PHP versions simultaneously
<?php function retry($retries, callable $fn) { while (true) { try { return $fn(); $retries--; } catch (\Exception $e) { if (!$retries) { throw new \Exception('', 0, $e); } } } } $fn = function() { if ($GLOBALS['counter'] > 0) { $GLOBALS['counter']--; throw new \Exception('Try again'); } return 'something successfull'; }; $start = microtime(true); try { $GLOBALS['counter'] = 999999; retry(1000000, $fn); } catch (\Exception $e) {} echo 'Retry finished in: ' . (microtime(true) -$start) . "\n";

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)
7.1.70.0070.66317.25
7.1.60.0100.68517.25
7.1.50.0070.64316.66
7.1.40.0070.65216.82
7.1.30.0070.78716.58
7.1.20.0000.64616.78
7.1.10.0130.73516.60
7.1.00.0070.60316.87
7.0.200.0100.90016.79
7.0.190.0070.95216.64
7.0.180.0070.90116.08
7.0.170.0130.88916.35
7.0.160.0170.89816.34
7.0.150.0130.91716.36
7.0.140.0171.01216.58
7.0.130.0030.89716.56
7.0.120.0100.97916.46
7.0.110.0130.86016.37
7.0.100.0101.00116.32
7.0.90.0101.07116.33
7.0.80.0100.91416.68
7.0.70.2030.92616.45
7.0.60.0170.96016.37
7.0.50.0070.88916.44
7.0.40.0030.91315.26
7.0.30.0030.89315.26
7.0.20.0070.91415.26
7.0.10.0030.91115.26
7.0.00.0000.98315.26
5.6.300.0101.66420.79
5.6.290.0001.55820.90
5.6.280.0071.60320.88
5.6.270.0031.72721.06
5.6.260.0101.72820.82
5.6.250.0131.70220.97
5.6.240.0031.91920.88
5.6.230.0031.56520.86
5.6.220.0031.68220.83
5.6.210.0101.51420.62
5.6.200.0031.62820.87
5.6.190.0071.54421.03
5.6.180.0031.56620.75
5.6.170.0101.53421.04
5.6.160.0001.52321.04
5.6.150.0071.72421.00
5.6.140.0031.72420.83
5.6.130.0101.59120.86
5.6.120.0031.54220.99
5.6.110.0031.45120.86
5.6.100.0001.60820.88
5.6.90.0031.54920.84
5.6.80.0101.58920.22
5.6.70.0101.72120.40
5.6.60.0171.53820.21
5.6.50.0101.50120.25
5.6.40.0071.53120.19
5.6.30.0171.68720.20
5.6.20.0131.61720.18
5.6.10.0131.53320.09
5.6.00.0031.54720.19
5.5.380.0001.77717.59
5.5.370.0171.78917.63
5.5.360.0031.65217.52
5.5.350.0031.58417.54
5.5.340.0071.57818.09
5.5.330.0101.64718.09
5.5.320.0031.73718.14
5.5.310.0071.61218.06
5.5.300.0031.69318.09
5.5.290.0071.59918.18
5.5.280.0071.58117.84
5.5.270.0071.57318.12
5.5.260.0031.55917.81
5.5.250.0071.59217.87
5.5.240.0071.58517.09
5.5.230.0001.53417.13
5.5.220.0101.61217.38
5.5.210.0171.60717.23
5.5.200.0071.54617.38
5.5.190.0001.67117.44
5.5.180.0071.70017.38
5.5.160.0101.66317.43
5.5.150.0071.56017.05
5.5.140.0031.49817.47
5.5.130.0101.64717.43
5.5.120.0031.59417.52
5.5.110.0071.66017.40
5.5.100.0031.55117.09
5.5.90.0841.57017.34
5.5.80.0101.66717.38
5.5.70.0031.54817.33
5.5.60.0031.59017.33
5.5.50.0071.50516.98
5.5.40.0101.59817.11
5.5.30.0031.68817.27
5.5.20.0031.60017.30
5.5.10.0031.64117.29
5.5.00.0071.55917.09
5.4.450.2461.57219.48
5.4.440.0031.54319.28
5.4.430.0031.65519.38
5.4.420.0031.50519.21
5.4.410.0031.55819.09
5.4.400.0071.57318.99
5.4.390.0101.55319.08
5.4.380.0031.53418.98
5.4.370.0001.57419.23
5.4.360.0031.58819.23
5.4.350.0031.63719.11
5.4.340.0171.52719.16
5.4.320.0131.50519.21
5.4.310.0071.45719.09
5.4.300.0031.70018.95
5.4.290.0071.55819.16
5.4.280.0101.55319.08
5.4.270.0031.67318.91
5.4.260.0031.46319.21
5.4.250.0001.48419.03
5.4.240.0101.62319.11
5.4.230.0031.50819.07
5.4.220.0031.46019.07
5.4.210.0031.66818.99
5.4.200.0001.67319.13
5.4.190.0001.59618.98
5.4.180.0001.67418.97
5.4.170.0031.54119.07
5.4.160.0031.48619.21
5.4.150.0071.56719.11
5.4.140.0071.63016.72
5.4.130.0031.52416.69
5.4.120.0001.52416.45
5.4.110.0031.51716.65
5.4.100.0031.54916.63
5.4.90.0031.44016.72
5.4.80.0101.64116.69
5.4.70.0001.52816.61
5.4.60.0031.47516.46
5.4.50.0071.45516.39
5.4.40.0031.44716.75
5.4.30.0071.49016.68
5.4.20.0001.50716.46
5.4.10.0001.57416.58
5.4.00.1791.55415.91

preferences:
28.17 ms | 401 KiB | 5 Q