3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '1|27|31|33'; $separator = '##|##'; $iterations = 100000; $time = microtime(true); for ($i = 0; $i < $iterations; $i++) { $result = str_replace('|', $separator, $input); } $time1 = microtime(true); echo 'processed in ' . (($time1 - $time) * 1000) . ' millisecs'; 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 in ' . (($time2 - $time1) * 1000) . ' millisecs';

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.4.10.0130.40915.18
7.4.00.0100.30115.01
7.3.130.0030.41215.02
7.3.120.0070.40214.96
7.3.110.0100.28714.86
7.3.100.0070.33214.82
7.3.90.0200.39514.86
7.3.80.0070.38014.73
7.3.70.0030.32214.89
7.3.60.0070.29214.91
7.3.50.0000.37214.77
7.3.40.0100.36015.00
7.3.30.0070.35614.78
7.3.20.0070.33816.55
7.3.10.0070.29616.61
7.3.00.0120.32416.65
7.2.260.0030.45614.98
7.2.250.0070.34015.05
7.2.240.0030.43015.32
7.2.230.0000.43215.01
7.2.220.0030.42314.96
7.2.210.0070.31615.13
7.2.200.0100.40815.12
7.2.190.0030.33815.18
7.2.180.0100.29515.18
7.2.170.0070.37214.96
7.2.160.0030.27715.21
7.2.150.0070.35516.70
7.2.140.0030.33617.13
7.2.130.0070.31116.86
7.2.120.0120.31816.90
7.2.110.0100.34216.96
7.2.100.0120.29416.86
7.2.90.0070.36817.08
7.2.80.0050.36216.90
7.2.70.0070.33517.12
7.2.60.0120.27516.93
7.2.50.0080.31416.91
7.2.40.0050.32316.83
7.2.30.0050.31217.10
7.2.20.0020.32116.90
7.2.10.0050.30317.01
7.2.00.0040.28917.83
7.1.330.0030.45815.79
7.1.320.0030.45215.70
7.1.310.0070.45515.95
7.1.300.0000.47515.95
7.1.290.0000.41416.01
7.1.280.0030.45615.99
7.1.270.0070.45015.87
7.1.260.0030.47415.83
7.1.250.0100.42915.90
7.1.240.0050.36815.70
7.1.230.0070.42115.82
7.1.220.0050.44415.65
7.1.210.0050.42715.85
7.1.200.0050.35715.80
7.1.190.0070.36815.85
7.1.180.0100.34815.83
7.1.170.0070.41415.78
7.1.160.0100.38615.89
7.1.150.0080.39715.71
7.1.140.0050.42915.53
7.1.130.0070.33815.91
7.1.120.0120.38415.88
7.1.110.0070.40215.81
7.1.100.0070.39015.88
7.1.90.0020.35015.98
7.1.80.0080.36415.76
7.1.70.0080.35416.35
7.1.60.0100.37716.88
7.1.50.0040.33616.18
7.1.40.0070.36915.82
7.1.30.0050.35815.73
7.1.20.0050.37315.72
7.1.10.0080.34115.84
7.1.00.0070.34715.63
7.0.330.0030.50415.46
7.0.320.0030.41115.34
7.0.310.0030.41415.45
7.0.300.0070.43115.37
7.0.290.0070.39715.48
7.0.280.0050.43215.27
7.0.270.0100.40815.27
7.0.260.0020.40715.22
7.0.250.0100.42415.34
7.0.240.0100.37915.59
7.0.230.0100.39115.47
7.0.220.0080.42115.24
7.0.210.0050.41215.39
7.0.200.0010.40615.76
7.0.190.0030.48115.39
7.0.180.0070.47515.44
7.0.170.0050.41215.50
7.0.160.0050.41215.34
7.0.150.0080.47915.47
7.0.140.0100.40315.36
7.0.130.0030.42515.46
7.0.120.0070.39415.43
7.0.110.0070.41515.54
7.0.100.0050.40815.45
7.0.90.0050.43915.37
7.0.80.0020.47815.43
7.0.70.0070.44215.55
7.0.60.0070.43215.49
7.0.50.0070.42715.59
7.0.40.0030.39913.34
7.0.30.0070.42713.37
7.0.20.0050.47113.35
7.0.10.0080.45313.34
7.0.00.0070.43013.26
5.6.400.0030.64414.21
5.6.390.0100.75714.45
5.6.380.0050.68714.52
5.6.370.0100.68914.11
5.6.360.0050.66314.54
5.6.350.0030.64214.38
5.6.340.0030.69614.23
5.6.330.0030.61814.41
5.6.320.0030.58714.15
5.6.310.0030.70714.40
5.6.300.0030.66514.35
5.6.290.0080.66514.35
5.6.280.0050.67614.33
5.6.270.0030.56414.42
5.6.260.0030.71114.40
5.6.250.0000.70014.32
5.6.240.0050.65414.46
5.6.230.0050.68414.44
5.6.220.0050.66514.29
5.6.210.0050.60514.30
5.6.200.0070.69514.58
5.6.190.0100.59914.53
5.6.180.0080.63314.21
5.6.170.0070.61814.27
5.6.160.0070.61514.28
5.6.150.0030.63214.58
5.6.140.0050.61514.35
5.6.130.0050.64714.35
5.6.120.0050.61414.37
5.6.110.0070.63314.25
5.6.100.0100.64814.17
5.6.90.0050.65414.21
5.6.80.0050.55114.02
5.6.70.0050.60614.30
5.6.60.0030.61614.25
5.6.50.0020.62914.41
5.6.40.0070.63614.27
5.6.30.0070.56614.23
5.6.20.0070.67914.20
5.6.10.0070.61614.25
5.6.00.0050.71414.23
5.5.380.0050.64212.87
5.5.370.0050.66412.71
5.5.360.0030.61012.65
5.5.350.0070.64912.64
5.5.340.0100.59212.77
5.5.330.0050.62512.91
5.5.320.0100.60912.76
5.5.310.0030.69312.76
5.5.300.0020.59412.76
5.5.290.0030.72312.88
5.5.280.0020.61012.71
5.5.270.0070.66212.84
5.5.260.0030.60812.76
5.5.250.0030.65212.62
5.5.240.0030.65712.68
5.5.230.0050.57512.64
5.5.220.0030.66812.73
5.5.210.0050.59512.67
5.5.200.0050.67612.61
5.5.190.0030.66112.64
5.5.180.0030.68112.69
5.5.170.0070.59412.66
5.5.160.0080.59812.62
5.5.150.0100.55212.85
5.5.140.0020.60312.70
5.5.130.0070.68412.82
5.5.120.0030.68112.66
5.5.110.0080.56712.67
5.5.100.0070.64912.79
5.5.90.0080.66712.64
5.5.80.0020.58312.80
5.5.70.0050.70012.60
5.5.60.0050.66512.63
5.5.50.0050.65212.67
5.5.40.0070.69612.64
5.5.30.0050.57612.78
5.5.20.0030.72112.78
5.5.10.0070.58512.89
5.5.00.0020.60112.68
5.4.450.0190.60514.01
5.4.440.0020.56813.86
5.4.430.0030.62213.85
5.4.420.0090.58213.98
5.4.410.0040.54513.92
5.4.400.0030.58913.87
5.4.390.0270.57013.84
5.4.380.0100.58113.79
5.4.370.0040.61013.80
5.4.360.0230.55213.82
5.4.350.0100.55113.86
5.4.340.0070.53113.86
5.4.330.0070.65311.22
5.4.320.0020.55613.85
5.4.310.0060.57213.75
5.4.300.0130.55613.88
5.4.290.0070.58113.74
5.4.280.0020.61713.74
5.4.270.0060.58113.91
5.4.260.0080.57313.81
5.4.250.0270.62813.85
5.4.240.0200.54213.87
5.4.230.0080.55513.74
5.4.220.0060.55213.84
5.4.210.0070.57013.86
5.4.200.0010.62013.84
5.4.190.0010.51913.87
5.4.180.0040.62713.85
5.4.170.0060.58313.85
5.4.160.0070.58113.74
5.4.150.0040.56113.74
5.4.140.0040.58312.93
5.4.130.0030.56212.90
5.4.120.0040.62512.97
5.4.110.0030.56012.95
5.4.100.0030.57812.89
5.4.90.0040.62012.91
5.4.80.0020.56712.93
5.4.70.0320.58212.95
5.4.60.0060.54913.01
5.4.50.0030.61212.91
5.4.40.0030.62012.90
5.4.30.0070.55612.92
5.4.20.0030.52812.89
5.4.10.0060.54713.01
5.4.00.0070.56712.74
5.3.290.0040.70812.35
5.3.280.0070.72612.34
5.3.270.0060.67512.29
5.3.260.0030.65412.29
5.3.250.0030.64712.33
5.3.240.0030.63712.33
5.3.230.0020.66012.34
5.3.220.0040.69612.32
5.3.210.0020.66812.32
5.3.200.0040.65812.33
5.3.190.0020.64512.32
5.3.180.0040.64112.32
5.3.170.0030.71812.33
5.3.160.0080.63212.33
5.3.150.0080.69912.32
5.3.140.0030.66012.32
5.3.130.0030.71212.33
5.3.120.0040.66612.34
5.3.110.0270.62412.32
5.3.100.0040.72912.14
5.3.90.0020.72312.19
5.3.80.0080.64512.10
5.3.70.0020.63112.19
5.3.60.0020.64312.09
5.3.50.0100.66412.08
5.3.40.0060.65112.12
5.3.30.0030.63212.10
5.3.20.0040.63712.03
5.3.10.0030.60812.03
5.3.00.0110.59712.01

preferences:
34.66 ms | 401 KiB | 5 Q