3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = array(0 => 1, 2 => 3, 4 => 5, 6 => 7, 8 => 9); each($x); $it = new ArrayIterator($x); while ($it->valid()) { $key = $it->key(); $value = $it->current(); $it->next(); echo "first loop (each):" . $key . "=>" . $value . "\n"; if ($key == 4) { break; } } while ($it->valid()) { $key = $it->key(); $value = $it->current(); $it->next(); echo "second loop (each):" . $key . "=>" . $value . "\n"; } reset($x); while (list($key, $value) = each($x)) { echo "first loop (each):" . $key . "=>" . $value . "\n"; if ($key == 4) { break; } } while (list($key, $value) = each($x)) { echo "second loop (each):" . $key . "=>" . $value . "\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)
8.3.60.0110.00418.55
8.3.50.0070.00716.16
8.3.40.0060.01318.66
8.3.30.0040.01118.84
8.3.20.0080.00020.96
8.3.10.0070.00021.64
8.3.00.0040.00419.66
8.2.180.0110.00716.75
8.2.170.0000.01522.96
8.2.160.0040.01120.57
8.2.150.0080.00025.66
8.2.140.0030.00524.66
8.2.130.0000.00726.16
8.2.120.0050.00321.04
8.2.110.0070.00320.47
8.2.100.0060.00617.84
8.2.90.0050.00319.10
8.2.80.0050.00317.97
8.2.70.0080.00017.63
8.2.60.0000.00817.79
8.2.50.0060.00318.10
8.2.40.0040.00420.45
8.2.30.0000.00719.07
8.2.20.0000.00718.09
8.2.10.0000.00818.13
8.2.00.0000.00717.95
8.1.280.0070.01025.92
8.1.270.0040.00422.11
8.1.260.0060.00326.35
8.1.250.0060.00328.09
8.1.240.0030.00720.77
8.1.230.0080.00319.15
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0060.00317.25
8.1.190.0050.00317.23
8.1.180.0050.00218.10
8.1.170.0050.00518.53
8.1.160.0030.00318.94
8.1.150.0040.00420.52
8.1.140.0070.00219.57
8.1.130.0000.00718.84
8.1.120.0030.00517.44
8.1.110.0040.00417.42
8.1.100.0030.00517.39
8.1.90.0000.00717.43
8.1.80.0100.00017.47
8.1.70.0030.00317.43
8.1.60.0050.00317.50
8.1.50.0000.00717.54
8.1.40.0030.00617.56
8.1.30.0000.00817.68
8.1.20.0130.00017.64
8.1.10.0020.00517.56
8.1.00.0000.00817.41
8.0.300.0030.00518.77
8.0.290.0000.00716.75
8.0.280.0000.00718.44
8.0.270.0030.00317.20
8.0.260.0030.00316.84
8.0.250.0030.00316.89
8.0.240.0040.00416.99
8.0.230.0040.00416.84
8.0.220.0000.00716.80
8.0.210.0070.00016.90
8.0.200.0030.00616.96
8.0.190.0000.00816.96
8.0.180.0000.00816.98
8.0.170.0040.00316.99
8.0.160.0070.00017.02
8.0.150.0040.00416.74
8.0.140.0020.00516.78
8.0.130.0000.00513.30
8.0.120.0000.00816.77
8.0.110.0040.00416.93
8.0.100.0070.00016.86
8.0.90.0050.00216.98
8.0.80.0050.01216.90
8.0.70.0000.00816.78
8.0.60.0050.00316.74
8.0.50.0050.00316.84
8.0.30.0070.01317.08
8.0.20.0080.01017.40
8.0.10.0080.00016.93
8.0.00.0060.01216.95
7.4.330.0050.00015.55
7.4.320.0000.00616.41
7.4.300.0030.00316.43
7.4.290.0030.00316.53
7.4.280.0050.00216.53
7.4.270.0000.00716.48
7.4.260.0040.00413.23
7.4.250.0070.00016.57
7.4.240.0000.00716.59
7.4.230.0030.00316.61
7.4.220.0190.00616.47
7.4.210.0080.00816.54
7.4.200.0070.00016.33
7.4.160.0120.00516.58
7.4.150.0060.01317.40
7.4.140.0080.01217.86
7.4.130.0110.00716.37
7.4.120.0100.01116.65
7.4.110.0120.00616.70
7.4.100.0100.01116.49
7.4.90.0090.00916.76
7.4.80.0120.01219.39
7.4.70.0100.00716.60
7.4.60.0060.01016.64
7.4.50.0070.00716.60
7.4.40.0050.01116.64
7.4.30.0080.00816.55
7.4.10.0100.00714.84
7.4.00.0060.00815.19
7.3.330.0030.00313.24
7.3.320.0030.00313.16
7.3.310.0070.00016.49
7.3.300.0040.00416.31
7.3.290.0000.00716.46
7.3.280.0090.00816.41
7.3.270.0170.00317.40
7.3.260.0060.01116.37
7.3.250.0120.01116.39
7.3.240.0090.00816.49
7.3.230.0000.01716.50
7.3.210.0070.01016.42
7.3.200.0090.00616.49
7.3.190.0110.00516.41
7.3.180.0150.00716.37
7.3.170.0110.00816.57
7.3.160.0060.01016.54
7.3.130.0090.00915.04
7.3.120.0090.00914.93
7.3.110.0030.01214.64
7.3.100.0110.00414.92
7.3.90.0030.01214.94
7.3.80.0060.00914.92
7.3.70.0060.00614.88
7.3.60.0060.00314.96
7.3.50.0110.00414.87
7.3.40.0070.00714.91
7.3.30.0050.00514.75
7.3.20.0080.00416.80
7.3.10.0080.00816.46
7.3.00.0030.01016.86
7.2.330.0030.01416.60
7.2.320.0110.00716.59
7.2.310.0110.00616.57
7.2.300.0060.01316.71
7.2.290.0080.00816.41
7.2.260.0070.01115.28
7.2.250.0080.00815.00
7.2.240.0040.01214.77
7.2.230.0060.01015.27
7.2.220.0070.00415.08
7.2.210.0060.00615.29
7.2.200.0060.00915.20
7.2.190.0030.01315.09
7.2.180.0070.01015.07
7.2.170.0000.01215.22
7.2.160.0000.01315.02
7.2.150.0070.00716.74
7.2.140.0090.00616.86
7.2.130.0100.00316.96
7.2.120.0060.00917.07
7.2.110.0040.01517.04
7.2.100.0000.00917.01
7.2.90.0040.01117.13
7.2.80.0030.01216.96
7.2.70.0060.00916.77
7.2.60.0090.00516.80
7.2.50.0000.01116.81
7.2.40.0090.00616.96
7.2.30.0040.01416.80
7.2.20.0100.00617.05
7.2.10.0060.01016.78
7.2.00.0040.01118.01
7.1.330.0040.00715.54
7.1.320.0070.00715.70
7.1.310.0060.00615.85
7.1.300.0070.00715.78
7.1.290.0040.00715.74
7.1.280.0070.00315.89
7.1.270.0030.01215.88
7.1.260.0030.01015.98
7.1.250.0040.00815.91
7.1.240.0060.01215.94
7.1.230.0040.01415.87
7.1.220.0080.00415.70
7.1.210.0030.01015.82
7.1.200.0020.01215.77
7.1.190.0070.01015.89
7.1.180.0070.00715.87
7.1.170.0000.01015.77
7.1.160.0030.01415.52
7.1.150.0070.01015.63
7.1.140.0070.00715.67
7.1.130.0000.01215.72
7.1.120.0070.00715.80
7.1.110.0030.00915.87
7.1.100.0040.00716.68
7.1.90.0000.01315.70
7.1.80.0120.00315.67
7.1.70.0040.00916.27
7.1.60.1630.01224.40
7.1.50.1730.01924.35
7.1.40.0220.01124.23
7.1.30.1450.01424.07
7.1.20.0250.01524.19
7.1.10.0080.01115.19
7.1.00.0030.01515.19
7.0.330.0000.01015.46
7.0.320.0040.00715.22
7.0.310.0030.01515.29
7.0.300.0000.01315.43
7.0.290.0040.01115.39
7.0.280.0080.00815.41
7.0.270.0030.01115.12
7.0.260.0070.00715.55
7.0.250.0070.00715.23
7.0.240.0000.01215.45
7.0.230.0040.01115.45
7.0.220.0030.01215.44
7.0.210.0090.00015.55
7.0.200.1430.00815.31
7.0.190.0150.00815.01
7.0.180.0340.01014.86
7.0.170.1370.01115.01
7.0.160.1330.01015.05
7.0.150.1620.01214.67
7.0.140.0430.00714.95
7.0.130.0270.01114.96
7.0.120.0340.00814.80
7.0.110.0530.00915.11
7.0.100.0080.01014.89
7.0.90.0100.00814.96
7.0.80.0390.01115.00
7.0.70.0100.01014.73
7.0.60.0080.00914.74
7.0.50.0140.00514.98
7.0.40.0070.01214.16
7.0.30.0120.00414.15
7.0.20.0570.01214.22
7.0.10.2420.00814.15
7.0.00.0390.00914.23
5.6.400.0090.00614.42
5.6.390.0130.00314.39
5.6.380.0000.00914.23
5.6.370.0070.01014.64
5.6.360.0000.01514.42
5.6.350.0050.00814.31
5.6.340.0070.01014.41
5.6.330.0000.01814.47
5.6.320.0060.00914.57
5.6.310.0060.00614.06
5.6.300.0050.00514.48
5.6.290.0120.00014.33
5.6.280.0030.00914.47
5.6.270.0040.00714.79
5.6.260.0040.00814.46
5.6.250.0080.00014.29
5.6.240.0040.00814.27
5.6.230.0030.01014.17
5.6.220.0060.00614.51
5.6.210.0070.00714.51
5.6.200.0070.00714.36
5.6.190.0060.00614.48
5.6.180.0060.00614.52
5.6.170.0090.00614.34
5.6.160.0040.00814.37
5.6.150.0070.00314.50
5.6.140.0000.01814.04
5.6.130.0030.01014.18
5.6.120.0070.00714.64
5.6.110.0000.01014.24
5.6.100.0000.00814.55
5.6.90.0000.01114.65
5.6.80.0040.00714.48
5.6.70.0040.00814.07
5.6.60.0000.01714.39
5.6.50.0060.00614.39
5.6.40.0090.00614.49
5.6.30.0030.01514.14
5.6.20.0060.01214.62
5.6.10.0000.01614.32
5.6.00.0080.00414.24

preferences:
66.65 ms | 400 KiB | 5 Q