3v4l.org

run code in 300+ PHP versions simultaneously
<?php $values = range(1, 10000); $c = 0; $start = microtime(true); $l = count($values); $i = 0; while ($i < $l) { $c++; $i++; } $end = microtime(true); printf('while $i++ %d iterations in: %f sec', $c, ($end - $start)); echo PHP_EOL; $values = range(1, 10000); $c = 0; $start = microtime(true); $l = count($values); for ($i = 0; $i < $l; $i++) { $c++; } $end = microtime(true); printf('for $i++ %d iterations in: %f sec', $c, ($end - $start)); echo PHP_EOL; $values = range(1, 10000); $c = 0; $start = microtime(true); foreach ($values as $val) { $c++; } $end = microtime(true); printf('foreach %d iterations in: %f sec', $c, ($end - $start)); echo PHP_EOL; $values = range(1, 10000); $c = 0; $start = microtime(true); $value = reset($values); while ($value) { $c++; $value = next($values); } $end = microtime(true); printf('while reset, next %d iterations in: %f sec', $c, ($end - $start)); echo PHP_EOL; $values = range(1, 10000); $c = 0; $start = microtime(true); while ($val = current($values)) { $c++; next($values); } $end = microtime(true); printf('while current, next %d iterations in: %f sec', $c, ($end - $start)); echo PHP_EOL; $values = range(1, 10000); $c = 0; $start = microtime(true); $value = current($values); do{ $c++; }while($value = next($values)); $end = microtime(true); printf('do while next %d iterations in %f sec', $c, ($end - $start)); echo PHP_EOL; $values = range(1, 10000); $c = 0; $start = microtime(true); while ($values) { $c++; array_shift($values); } $end = microtime(true); printf('while array_shift %d iterations in: %f sec', $c, ($end - $start)); echo PHP_EOL; $values = range(1, 10000); $c = 0; $start = microtime(true); $values = array_reverse($values); while ($values) { $c++; array_pop($values); } $end = microtime(true); printf('while array_pop %d iterations in: %f sec', $c, ($end - $start)); echo PHP_EOL;

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.2.100.0090.09517.92
8.2.70.0060.09179.33
8.2.60.0120.09326.81
8.2.50.0100.09379.33
8.2.40.0200.08679.33
8.2.30.0030.09479.33
8.2.20.0130.09379.33
8.2.10.0110.09438.52
8.2.00.0080.09233.41
8.1.200.0070.11779.33
8.1.190.0120.11138.65
8.1.180.0140.11079.33
8.1.170.0190.10679.33
8.1.160.0220.15179.33
8.1.150.0100.12279.33
8.1.140.0130.11179.33
8.1.130.0060.11128.31
8.1.120.0070.11948.78
8.1.110.0080.11433.44
8.1.100.0100.11348.75
8.1.90.0070.11748.76
8.1.80.0130.11048.73
8.1.70.0130.12148.74
8.1.60.0050.11522.63
8.1.50.0210.10448.81
8.1.40.0120.12148.81
8.1.30.0110.12048.85
8.1.20.0160.12048.84
8.1.10.0100.12348.78
8.1.00.0150.11948.76
8.0.290.0190.10479.33
8.0.280.0090.11238.40
8.0.270.0110.11679.33
8.0.260.0050.11227.83
8.0.250.0150.11048.45
8.0.240.0100.11232.98
8.0.230.0140.11248.45
8.0.220.0130.11248.45
8.0.210.0150.10948.35
8.0.200.0160.10848.41
8.0.190.0110.11532.99
8.0.180.0110.11448.43
8.0.170.0150.11148.46
8.0.160.0130.11148.44
8.0.150.0100.11148.38
8.0.140.0120.11248.40
8.0.130.0080.11348.33
8.0.120.0150.10948.38
8.0.110.0130.11048.40
8.0.100.0120.11148.34
8.0.90.0150.10748.38
8.0.80.0100.11148.42
8.0.70.0100.11448.41
8.0.60.0080.12048.42
8.0.50.0110.11648.41
8.0.30.0070.12848.39
8.0.20.0160.12048.40
8.0.10.0130.11548.48
8.0.00.0120.12048.52
7.4.330.0070.11923.94
7.4.320.0090.13032.71
7.4.300.0110.11827.54
7.4.290.0110.11632.80
7.4.280.0060.13048.24
7.4.270.0100.12248.25
7.4.260.0130.11048.19
7.4.250.0110.16231.12
7.4.240.0120.13148.19
7.4.230.0170.11648.25
7.4.220.0070.12348.28
7.4.210.0100.12648.24
7.4.200.0100.16532.75
7.4.190.0100.12848.27
7.4.180.0130.11848.29
7.4.160.0120.12748.25
7.4.150.0120.12448.20
7.4.140.0160.11548.21
7.4.130.0130.11748.20
7.4.120.0100.14448.13
7.4.110.0140.17132.72
7.4.100.0080.14927.51
7.4.90.0170.17632.71
7.4.80.0120.15832.71
7.4.70.0140.16732.68
7.4.60.0100.16632.71
7.4.50.0130.15232.66
7.4.40.0090.16432.68
7.4.30.0110.16232.73
7.4.20.0140.16129.53
7.4.10.0120.17727.50
7.4.00.0110.14921.90
7.3.330.0060.11832.77
7.3.320.0090.11448.10
7.3.310.0020.12048.10
7.3.300.0100.11448.10
7.3.290.0130.11548.13
7.3.280.0120.11148.10
7.3.270.0130.11148.17
7.3.260.0070.11648.17
7.3.250.0160.10748.10
7.3.240.0100.11348.18
7.3.230.0250.15232.63
7.3.220.0110.15332.57
7.3.210.0110.15932.63
7.3.200.0110.15932.60
7.3.190.0150.16232.66
7.3.180.0140.15432.64
7.3.170.0120.16432.65
7.3.160.0090.15832.69
7.3.150.0080.16232.57
7.3.140.0090.16532.60
7.3.130.0120.17027.33
7.3.120.0120.17225.69
7.3.110.0150.18125.68
7.3.100.0110.18625.77
7.3.90.0110.18325.76
7.3.80.0110.19425.76
7.3.70.0130.18625.67
7.3.60.0110.17925.63
7.3.50.0120.18825.70
7.3.40.0130.18925.61
7.3.30.0140.20725.73
7.3.20.0210.19025.73
7.3.10.0150.19025.65
7.3.00.0130.18925.73
7.2.340.0110.15327.48
7.2.330.0130.17032.78
7.2.320.0150.16032.78
7.2.310.0130.17032.78
7.2.300.0120.18132.75
7.2.290.0130.17432.78
7.2.280.0120.15832.72
7.2.270.0140.17132.67
7.2.260.0100.18027.60
7.2.250.0090.18525.86
7.2.240.0120.18725.78
7.2.230.0150.18625.93
7.2.220.0110.18925.90
7.2.210.0110.18525.81
7.2.200.0140.21925.86
7.2.190.0060.18525.82
7.2.180.0140.18325.83
7.2.170.0120.20425.86
7.2.160.0110.19725.87
7.2.150.0160.20625.90
7.2.140.0200.19825.97
7.2.130.0190.18525.99
7.2.120.0140.18424.66
7.2.110.0130.20924.63
7.2.100.0420.19922.03
7.2.90.0410.19622.14
7.2.80.0370.21122.12
7.2.70.0350.18422.19
7.2.60.0260.18322.23
7.2.50.0450.18822.16
7.2.40.0480.20322.24
7.2.30.0410.20022.20
7.2.20.0240.20222.14
7.2.10.0450.19022.20
7.2.00.0360.17721.22
7.1.330.0240.18925.15
7.1.320.0160.19225.12
7.1.310.0170.19225.15
7.1.300.0140.18425.09
7.1.290.0190.18625.11
7.1.280.0190.20325.09
7.1.270.0190.21825.10
7.1.260.0180.20225.08
7.1.250.0240.19625.12
7.1.240.0240.20223.71
7.1.230.0250.18923.79
7.1.220.0400.18721.27
7.1.210.0450.19321.25
7.1.200.0350.19321.23
7.1.190.0330.18721.20
7.1.180.0420.18421.25
7.1.170.0430.19421.21
7.1.160.0510.20421.25
7.1.150.0490.19221.27
7.1.140.0420.19621.28
7.1.130.0480.18721.24
7.1.120.0420.18721.20
7.1.110.0420.17821.23
7.1.100.0420.18721.31
7.1.90.0450.18621.25
7.1.80.0400.18521.21
7.1.70.0420.19121.15
7.1.60.0360.20326.17
7.1.50.0450.19126.13
7.1.40.0460.18826.13
7.1.30.0480.19126.11
7.1.20.0420.19826.13
7.1.10.0350.17521.24
7.1.00.0380.18121.20
7.0.330.0190.17323.08
7.0.320.0140.18426.60
7.0.310.0140.18326.62
7.0.300.0110.20026.67
7.0.290.0130.19226.68
7.0.280.0150.20426.64
7.0.270.0160.20026.64
7.0.260.0180.20626.65
7.0.250.0140.20126.66
7.0.240.0160.18226.72
7.0.230.0150.18626.67
7.0.220.0180.18726.67
7.0.210.0160.18926.73
7.0.200.0170.19826.70
7.0.190.0200.17426.69
7.0.180.0220.17526.68
7.0.170.0140.19926.65
7.0.160.0180.19626.70
7.0.150.0190.17726.70
7.0.140.0160.19526.69
7.0.130.0140.19026.73
7.0.120.0210.19526.61
7.0.110.0150.18426.62
7.0.100.0170.18726.66
7.0.90.0150.18226.69
7.0.80.0120.18526.62
7.0.70.0140.18826.64
7.0.60.0170.19226.63
7.0.50.0150.19426.64
7.0.40.0170.17826.60
7.0.30.0180.18226.61
7.0.20.0180.18726.60
7.0.10.0200.18426.62
7.0.00.0120.15922.73
5.6.400.0150.43724.09
5.6.390.0350.56127.25
5.6.380.0220.54023.57
5.6.370.0240.54028.76
5.6.360.0220.56928.88
5.6.350.0280.54928.96
5.6.340.0230.53728.84
5.6.330.0280.54428.94
5.6.320.0170.53128.92
5.6.310.0230.52728.84
5.6.300.0260.53228.86
5.6.290.0220.53628.96
5.6.280.0210.53628.88
5.6.270.0180.54628.83
5.6.260.0210.52428.85
5.6.250.0230.52128.83
5.6.240.0230.54528.88
5.6.230.0230.52928.90
5.6.220.0210.54928.80
5.6.210.0230.52328.92
5.6.200.0220.55128.87
5.6.190.0220.52928.86
5.6.180.0190.52528.88
5.6.170.0200.53428.83
5.6.160.0200.55028.89
5.6.150.0180.53628.81
5.6.140.0180.56228.91
5.6.130.0210.53628.94
5.6.120.0190.54428.87
5.6.110.0290.52128.87
5.6.100.0220.53928.94
5.6.90.0200.52828.94
5.6.80.0240.53728.84
5.6.70.0160.53628.88
5.6.60.0200.52728.75
5.6.50.0240.54728.83
5.6.40.0180.53528.83
5.6.30.0200.52928.79
5.6.20.0200.51928.83
5.6.10.0240.53028.79
5.6.00.0160.52728.79
5.3.60.0080.31424.66
5.3.30.0080.29624.66

preferences:
43.2 ms | 401 KiB | 5 Q