3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '1|27|31|33'; $separator = '##|##'; $iterations = 300000; $time = microtime(true); for ($i = 0; $i < $iterations; $i++) { $result = str_replace('|', $separator, $input); } $time1 = microtime(true); echo 'processed with str_replace in ' . round(($time1 - $time) * 1000) . ' millisecs' . PHP_EOL; for ($i = 0; $i < $iterations; $i++) { $result = ''; $it = new CachingIterator(new ArrayIterator(explode('|', $input)), CachingIterator::FULL_CACHE); foreach ($it as $categoryId) { $result .= $categoryId; if ($it->hasNext()) { $result .= $separator; } } } $time2 = microtime(true); echo 'processed with CachingIterator in ' . round(($time2 - $time1) * 1000) . ' millisecs' . 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)
7.2.00.0070.65919.46
7.1.70.0030.57017.38
7.1.60.0070.59919.24
7.1.50.0130.65416.95
7.1.00.0000.69722.28
7.0.200.0030.86416.48
7.0.140.0131.06322.15
7.0.100.0070.71020.04
7.0.90.0130.76319.93
7.0.80.0130.73020.14
7.0.70.0130.71719.93
7.0.60.0130.79019.95
7.0.50.0070.73320.30
7.0.40.0030.73320.18
7.0.30.0070.76320.20
7.0.20.0070.72320.11
7.0.10.0070.75320.02
7.0.00.0030.71020.17
5.6.280.0001.20020.89
5.6.250.0071.10720.58
5.6.240.0071.09320.68
5.6.230.0071.15720.71
5.6.220.0031.17020.60
5.6.210.0101.11320.73
5.6.200.0131.11320.97
5.6.190.0101.12721.04
5.6.180.0101.11321.09
5.6.170.0031.08321.03
5.6.160.0001.05021.04
5.6.150.0071.13721.03
5.6.140.0071.04021.05
5.6.130.0071.11321.06
5.6.120.0071.15020.97
5.6.110.0031.11721.11
5.6.100.0071.11321.07
5.6.90.0001.09721.05
5.6.80.0031.09720.48
5.6.70.0031.14020.46
5.6.60.0131.08320.42
5.6.50.0031.13320.44
5.6.40.0100.92720.50
5.6.30.0171.12020.34
5.6.20.0101.15020.39
5.6.10.0031.29020.37
5.6.00.0031.02320.37
5.5.380.0031.17720.35
5.5.370.0071.10720.39
5.5.360.0201.10720.33
5.5.350.0071.07020.45
5.5.340.0031.13020.92
5.5.330.0101.11020.85
5.5.320.0201.07720.66
5.5.310.0131.04720.79
5.5.300.0000.92320.65
5.5.290.0030.94020.84
5.5.280.0071.12720.91
5.5.270.0001.19720.90
5.5.260.0031.03020.73
5.5.250.0071.05020.70
5.5.240.0031.00020.13
5.5.230.0131.09320.21
5.5.220.0101.06320.16
5.5.210.0031.13020.29
5.5.200.0031.10020.29
5.5.190.0071.20720.20
5.5.180.0071.14720.19
5.5.160.0071.09020.19
5.5.150.0171.10020.14
5.5.140.0131.15020.28
5.5.130.0031.02320.19
5.5.120.0130.96020.19
5.5.110.0071.06720.27
5.5.100.0071.08020.17
5.5.90.0070.92319.99
5.5.80.0071.11320.09
5.5.70.0031.07320.07
5.5.60.0071.09020.14
5.5.50.0070.98319.94
5.5.40.0071.10020.07
5.5.30.0101.21320.09
5.5.20.0071.12720.06
5.5.10.0101.14320.09
5.5.00.0131.08720.04
5.4.450.0031.10719.43
5.4.440.0031.12019.29
5.4.430.0101.08019.39
5.4.420.0201.08719.17
5.4.410.0131.07319.21
5.4.400.0071.07718.84
5.4.390.0131.10019.20
5.4.380.0001.16019.02
5.4.370.0101.06719.06
5.4.360.0031.14719.17
5.4.350.0001.13719.14
5.4.340.0171.09019.06
5.4.320.0101.11019.12
5.4.310.0071.08318.98
5.4.300.0031.05018.96
5.4.290.0001.07319.18
5.4.280.0031.03719.06
5.4.270.0100.96719.17
5.4.260.0031.16319.02
5.4.250.0131.07019.14
5.4.240.0100.95019.07
5.4.230.0131.07719.07
5.4.220.0101.07319.31
5.4.210.0131.09319.09
5.4.200.0000.88719.10
5.4.190.0071.08318.84
5.4.180.0101.11018.91
5.4.170.0031.00319.07
5.4.160.0101.11719.18
5.4.150.0031.07318.94
5.4.140.0131.07716.37
5.4.130.0131.09016.38
5.4.120.0071.07716.34
5.4.110.0071.09016.23
5.4.100.0071.05316.40
5.4.90.0101.05716.32
5.4.80.0031.07716.39
5.4.70.0031.15016.42
5.4.60.0201.07716.25
5.4.50.0101.04716.25
5.4.40.0070.86716.44
5.4.30.0001.17016.30
5.4.20.0131.11316.26
5.4.10.0071.11016.30
5.4.00.0071.13715.77
5.3.290.0131.28014.59
5.3.280.0031.25714.63
5.3.270.0031.29714.57
5.3.260.0101.27314.60
5.3.250.0071.25314.67
5.3.240.0031.24314.55
5.3.230.0001.26314.54
5.3.220.0001.41314.58
5.3.210.0101.26314.56
5.3.200.0031.16714.63
5.3.190.0001.41314.52
5.3.180.0031.31314.53
5.3.170.0031.26714.52
5.3.160.0001.18014.54
5.3.150.0071.16714.51
5.3.140.0071.14714.63
5.3.130.0001.30014.63
5.3.120.0001.26014.54
5.3.110.0101.23014.49
5.3.100.0031.29314.05
5.3.90.0071.23013.91
5.3.80.0071.24713.95
5.3.70.0071.32313.98
5.3.60.0031.30313.99
5.3.50.0001.13713.91
5.3.40.0101.31013.95
5.3.30.0031.17013.88
5.3.20.0071.25713.65
5.3.10.0071.22013.66
5.3.00.0101.22013.64
5.2.170.0001.23311.34
5.2.160.0031.10011.41
5.2.150.0071.19011.25
5.2.140.0001.19711.24
5.2.130.0071.30711.05
5.2.120.0031.19011.30
5.2.110.0031.18711.37
5.2.100.0071.24311.06
5.2.90.0101.20011.20
5.2.80.0031.05011.19
5.2.70.0071.25311.21
5.2.60.0001.15311.01
5.2.50.0001.08011.18
5.2.40.0071.22311.09
5.2.30.0071.17711.02
5.2.20.0031.17710.98
5.2.10.0101.17011.13
5.2.00.0071.03710.91
5.1.60.0170.14710.91
5.1.50.0030.14310.91
5.1.40.0070.16010.91
5.1.30.0030.17310.91
5.1.20.0030.15710.91
5.1.10.0100.16310.91
5.1.00.0070.16710.91
5.0.50.0030.18010.91
5.0.40.0030.20310.91
5.0.30.0000.24710.91
5.0.20.0170.17010.91
5.0.10.0000.22310.91
5.0.00.0000.21010.91
4.4.90.0000.02710.91
4.4.80.0000.03710.91
4.4.70.0000.03710.91
4.4.60.0030.03310.91
4.4.50.0070.02710.91
4.4.40.0000.05310.91
4.4.30.0070.03310.91
4.4.20.0030.03710.91
4.4.10.0030.03710.91
4.4.00.0030.05710.91
4.3.110.0000.03710.91
4.3.100.0070.01710.91
4.3.90.0030.02010.91
4.3.80.0000.05310.91
4.3.70.0030.03010.91
4.3.60.0030.02710.91
4.3.50.0030.03310.91
4.3.40.0030.05310.91
4.3.30.0030.03310.91
4.3.20.0000.03710.91
4.3.10.0000.03310.91
4.3.00.0000.04010.91

preferences:
39.72 ms | 401 KiB | 5 Q