3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 1, false, 2, 3 ); $maxRetries = 5; class RetryIterator { protected static $_currentRetries = 0; public static function iterate($element) { var_dump($element); if ($element == 2) { throw new Exception('Something went wrong'); } } public static function handleException($e, $array) { var_dump('Exception handled'); } public static function retry(&$array, $maxRetries, $iterateCallback, $handleCallback) { while (!empty($array)) { reset($array); $key = key($array); try { call_user_func($iterateCallback, ($array[$key])); unset($array[$key]); } catch (Exception $e) { static::$_currentRetries++; if (static::$_currentRetries <= $maxRetries) { call_user_func($handleCallback, $e, $array); } else { throw new Exception('maxRetries reached'); } } } } } RetryIterator::retry($arr, 5, 'RetryIterator::iterate', 'RetryIterator::handleException');

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.0150.00418.68
8.3.50.0120.01121.98
8.3.40.0120.00318.98
8.3.30.0070.00719.22
8.3.20.0040.00420.25
8.3.10.0060.00322.01
8.3.00.0080.00022.37
8.2.180.0090.00916.75
8.2.170.0110.00422.96
8.2.160.0070.00721.02
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0150.00426.16
8.2.120.0070.00417.63
8.2.110.0060.00322.25
8.2.100.0110.00017.84
8.2.90.0080.00019.36
8.2.80.0040.00418.15
8.2.70.0000.00817.63
8.2.60.0050.00317.93
8.2.50.0060.00318.07
8.2.40.0060.00318.34
8.2.30.0000.01018.14
8.2.20.0040.00417.61
8.2.10.0000.00817.81
8.2.00.0000.00817.83
8.1.280.0090.00925.92
8.1.270.0060.00322.25
8.1.260.0050.00326.35
8.1.250.0030.00528.09
8.1.240.0060.00323.91
8.1.230.0070.00319.10
8.1.220.0000.00817.91
8.1.210.0030.00518.77
8.1.200.0060.00317.36
8.1.190.0080.00017.63
8.1.180.0080.00018.84
8.1.170.0000.00818.70
8.1.160.0040.00422.04
8.1.150.0000.00818.57
8.1.140.0040.00417.39
8.1.130.0000.00717.73
8.1.120.0040.00417.37
8.1.110.0040.00417.53
8.1.100.0040.00417.38
8.1.90.0070.00017.30
8.1.80.0070.00017.54
8.1.70.0030.00317.42
8.1.60.0070.00417.50
8.1.50.0000.00817.50
8.1.40.0030.00517.47
8.1.30.0060.00317.60
8.1.20.0020.00517.52
8.1.10.0040.00417.59
8.1.00.0000.00817.41
8.0.300.0040.00418.77
8.0.290.0070.00017.04
8.0.280.0070.00018.34
8.0.270.0050.00317.33
8.0.260.0040.00416.86
8.0.250.0070.00016.96
8.0.240.0030.00316.95
8.0.230.0040.00417.05
8.0.220.0040.00416.91
8.0.210.0000.00716.93
8.0.200.0000.00817.05
8.0.190.0050.00317.08
8.0.180.0000.00717.01
8.0.170.0070.00016.92
8.0.160.0000.00816.94
8.0.150.0070.00016.81
8.0.140.0040.00416.95
8.0.130.0000.00513.44
8.0.120.0040.00416.94
8.0.110.0040.00416.80
8.0.100.0040.00416.99
8.0.90.0000.00817.05
8.0.80.0180.00417.03
8.0.70.0020.00516.98
8.0.60.0040.00416.92
8.0.50.0040.00416.76
8.0.30.0090.00917.10
8.0.20.0100.00917.40
8.0.10.0040.00416.98
8.0.00.0070.01016.83
7.4.330.0000.00515.00
7.4.320.0030.00316.51
7.4.300.0030.00316.55
7.4.290.0000.00816.38
7.4.280.0030.00716.50
7.4.270.0030.00316.48
7.4.260.0060.00316.53
7.4.250.0040.00416.46
7.4.240.0000.00816.50
7.4.230.0050.00316.71
7.4.220.0000.02416.65
7.4.210.0090.00916.55
7.4.200.0000.00716.43
7.4.190.0000.00716.43
7.4.160.0090.01416.48
7.4.150.0110.00617.40
7.4.140.0140.00717.86
7.4.130.0070.01116.54
7.4.120.0120.01016.56
7.4.110.0160.00016.35
7.4.100.0110.01416.43
7.4.90.0140.00516.63
7.4.80.0090.00919.39
7.4.70.0100.00716.54
7.4.60.0060.01316.48
7.4.50.0000.00816.40
7.4.40.0130.00322.77
7.4.30.0090.00816.74
7.4.00.0120.00315.07
7.3.330.0050.00013.34
7.3.320.0000.00613.38
7.3.310.0030.00616.36
7.3.300.0000.00616.39
7.3.290.0150.00016.39
7.3.280.0100.00716.38
7.3.270.0060.01217.40
7.3.260.0210.00516.38
7.3.250.0080.01016.50
7.3.240.0160.01016.46
7.3.230.0070.01316.39
7.3.210.0000.01816.50
7.3.200.0090.01216.52
7.3.190.0150.00416.53
7.3.180.0160.00016.43
7.3.170.0090.00616.58
7.3.160.0030.01816.40
7.3.120.0060.01014.89
7.3.10.0160.00816.43
7.3.00.0090.00916.27
7.2.330.0080.00816.43
7.2.320.0090.00916.62
7.2.310.0100.00716.52
7.2.300.0090.00916.61
7.2.290.0080.00816.59
7.2.130.0130.01016.63
7.2.120.0140.00716.62
7.2.110.0110.00716.02
7.2.100.0190.00316.52
7.2.90.0120.00616.59
7.2.80.0100.01416.80
7.2.70.0090.01216.63
7.2.60.0080.00916.69
7.2.50.0110.01116.54
7.2.40.0120.01316.73
7.2.30.0220.00016.64
7.2.20.0120.00816.78
7.2.10.0120.00616.65
7.2.00.0080.01118.20
7.1.250.0110.00815.18
7.1.200.0090.00515.50
7.1.100.0060.00918.33
7.1.70.0060.00617.27
7.1.60.0000.01219.82
7.1.50.0110.00716.86
7.1.00.0100.07722.54
7.0.200.0030.01016.95
7.0.140.0030.07322.18
7.0.60.0030.04719.96
7.0.50.0070.08317.89
7.0.40.0070.08720.01
7.0.30.0570.07320.32
7.0.20.0300.04720.12
7.0.10.0000.05020.33
7.0.00.0130.03720.16
5.6.280.0030.07320.82
5.6.210.0100.08020.66
5.6.200.0000.04718.12
5.6.190.0030.04320.52
5.6.180.3830.04320.33
5.6.170.0200.04320.51
5.6.160.0070.04720.44
5.6.150.0030.03718.16
5.6.140.0030.07718.23
5.6.130.0070.07718.18
5.6.120.0100.05321.11
5.6.110.0100.03321.11
5.6.100.0100.08321.03
5.6.90.0070.08721.11
5.6.80.0030.08320.25
5.6.70.4600.04020.35
5.5.350.0270.07320.37
5.5.340.0100.07017.95
5.5.330.0170.07320.43
5.5.320.0300.06020.37
5.5.310.0230.04020.33
5.5.300.0200.06317.95
5.5.290.0070.08017.98
5.5.280.0170.04320.66
5.5.270.0170.07020.65
5.5.260.0030.08020.65
5.5.250.0000.09320.62
5.5.240.0200.07320.27
5.4.450.0630.04719.38
5.4.440.0700.07019.47
5.4.430.0030.06019.52
5.4.420.0100.05719.68
5.4.410.0270.04318.70
5.4.400.0100.06018.83
5.4.390.0130.04718.51
5.4.380.0130.05318.57
5.4.370.0300.05718.63
5.4.360.0270.05718.78
5.4.350.0270.05718.58
5.4.340.0200.06718.62
5.4.320.0050.03812.52
5.4.310.0060.03712.51
5.4.300.0070.03712.51
5.4.290.0060.04612.51
5.4.280.0080.03312.41
5.4.270.0080.04612.41
5.4.260.0100.06319.00
5.4.250.0170.07018.99
5.4.240.0100.08018.65
5.4.230.0170.04318.95
5.4.220.0230.04018.93
5.4.210.0130.07318.74
5.4.200.0130.05318.96
5.4.190.0100.05018.83
5.4.180.0070.05018.76
5.4.170.0130.04718.79
5.4.160.0230.04318.79
5.4.150.0130.05318.72
5.4.140.0070.05316.33
5.4.130.0030.06016.34
5.4.120.0000.06016.43
5.4.110.0000.06016.29
5.4.100.0100.05316.42
5.4.90.0070.07316.37
5.4.80.0070.05016.63
5.4.70.0100.05016.53
5.4.60.0070.05016.52
5.4.50.0130.05716.44
5.4.40.0100.04716.59
5.4.30.0070.05016.36
5.4.20.0070.05016.48
5.4.10.0130.05016.45
5.4.00.0070.04715.99
5.3.290.0080.04212.80
5.3.280.0170.04314.51
5.3.270.0070.05714.68
5.3.260.0100.05714.79
5.3.250.0130.07014.62
5.3.240.0100.05314.64
5.3.230.0070.05314.63
5.3.220.0100.04714.73
5.3.210.0070.08314.67
5.3.200.0070.05014.55
5.3.190.0100.04714.67
5.3.180.0100.04714.80
5.3.170.0100.05014.55
5.3.160.0100.04714.77
5.3.150.0030.05714.66
5.3.140.0170.04014.65
5.3.130.0170.04714.70
5.3.120.0000.06314.74
5.3.110.0070.05014.46
5.3.100.0030.05314.21
5.3.90.0130.05314.11
5.3.80.0100.06313.94
5.3.70.0170.04014.21
5.3.60.0030.06313.98
5.3.50.0070.05314.05
5.3.40.0070.05314.05
5.3.30.0070.05713.99
5.3.20.0070.06313.79
5.3.10.0070.07013.73
5.3.00.0070.05013.57
5.2.170.0130.03711.37
5.2.160.0170.02711.24
5.2.150.0000.04711.15
5.2.140.0130.04711.05
5.2.130.0100.05311.06
5.2.120.0070.03711.08
5.2.110.0030.05311.07
5.2.100.0000.05011.09
5.2.90.0000.06310.94
5.2.80.0070.04011.26
5.2.70.0070.05011.18
5.2.60.0070.04011.02
5.2.50.0070.04311.00
5.2.40.0030.04311.07
5.2.30.0100.03711.06
5.2.20.0130.04011.14
5.2.10.0000.04311.03
5.2.00.0000.05710.91
5.1.60.0070.03010.20
5.1.50.0070.04710.05
5.1.40.0030.0409.99
5.1.30.0000.04010.36
5.1.20.0070.04310.52
5.1.10.0000.04310.17
5.1.00.0070.03310.07
5.0.50.0230.0138.62
5.0.40.0030.0308.40
5.0.30.0070.0508.32
5.0.20.0030.0338.15
5.0.10.0000.0408.15
5.0.00.0070.0378.21
4.4.90.0000.0236.84
4.4.80.0000.0236.84
4.4.70.0000.0276.84
4.4.60.0000.0336.84
4.4.50.0000.0236.84
4.4.40.0030.0336.84
4.4.30.0070.0176.84
4.4.20.0030.0276.84
4.4.10.0070.0206.84
4.4.00.0000.0476.84
4.3.110.0030.0306.84
4.3.100.0030.0236.84
4.3.90.0030.0236.84
4.3.80.0000.0376.84
4.3.70.0100.0136.84
4.3.60.0000.0236.84
4.3.50.0000.0236.84
4.3.40.0030.0436.84
4.3.30.0000.0236.84
4.3.20.0000.0336.84
4.3.10.0030.0206.84
4.3.00.0000.0236.86

preferences:
59.22 ms | 401 KiB | 5 Q