3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '1|27|31|33'; $separator = '##|##'; $iterations = 1000000; $time = microtime(true); var_dump($time); 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.00.0102.49015.01
7.3.120.0032.49414.82
7.3.110.0072.49215.00
7.3.100.0132.48614.80
7.3.90.0032.49614.96
7.3.80.0102.48914.54
7.3.70.0102.48814.79
7.3.60.0102.48814.82
7.3.50.0002.49914.91
7.3.40.0032.49514.63
7.3.30.0032.49614.53
7.3.20.0072.48816.50
7.3.10.0072.44316.71
7.3.00.0102.48316.80
7.2.250.0102.48815.29
7.2.240.0072.49115.23
7.2.230.0102.48915.25
7.2.220.0332.44014.98
7.2.210.0072.49215.12
7.2.200.0032.49514.81
7.2.190.0102.48815.12
7.2.180.0002.49914.94
7.2.170.0072.47814.82
7.2.160.0032.43015.05
7.2.150.0002.49916.79
7.2.140.0032.48517.02
7.2.130.0032.49517.07
7.2.120.0102.48816.99
7.2.110.0002.49817.04
7.2.100.0032.49516.82
7.2.90.0072.49217.01
7.2.80.0032.49516.95
7.2.70.0002.49817.04
7.2.60.0032.49616.88
7.2.50.0032.49416.96
7.2.40.0032.49117.02
7.2.30.0032.49516.82
7.2.20.0072.49216.73
7.2.10.0032.49316.98
7.2.00.0022.20518.27
7.1.330.0162.47815.76
7.1.320.0032.48915.71
7.1.310.0032.49515.93
7.1.300.0032.49515.88
7.1.290.0032.48916.02
7.1.280.0032.47415.74
7.1.270.0032.49615.78
7.1.260.0032.49515.83
7.1.250.0132.48415.86
7.1.240.0002.49715.85
7.1.230.0032.49515.74
7.1.220.0072.48615.77
7.1.210.0032.49415.84
7.1.200.0072.49215.82
7.1.190.0002.49215.58
7.1.180.0032.49515.76
7.1.170.0072.48715.89
7.1.160.0072.49215.79
7.1.150.0032.49515.61
7.1.140.0002.49915.53
7.1.130.0072.49115.86
7.1.120.0032.49515.60
7.1.110.0032.49315.93
7.1.100.0072.49215.80
7.1.90.0032.48915.71
7.1.80.0032.49515.75
7.1.70.0032.34316.48
7.1.60.0052.20117.61
7.1.50.0082.26116.38
7.1.40.0032.49515.89
7.1.30.0002.49915.85
7.1.20.0132.48015.88
7.1.10.0102.48915.89
7.1.00.0002.36619.04
7.0.330.0072.49215.52
7.0.320.0032.49415.68
7.0.310.0032.49215.39
7.0.300.0002.49815.48
7.0.290.0032.49415.23
7.0.280.0002.49315.21
7.0.270.0032.49515.14
7.0.260.0032.49415.39
7.0.250.0032.49515.48
7.0.240.0032.49615.61
7.0.230.0072.49215.31
7.0.220.0032.49115.53
7.0.210.0032.49515.69
7.0.200.0072.35716.03
7.0.190.0072.49115.58
7.0.180.0102.48915.62
7.0.170.0002.49915.57
7.0.160.0072.49215.63
7.0.150.0032.49315.45
7.0.140.0052.49418.78
7.0.130.0032.49415.53
7.0.120.0032.49615.48
7.0.110.0102.48915.58
7.0.100.0052.21218.67
7.0.90.0072.18018.50
7.0.80.0022.16218.50
7.0.70.0002.20418.63
7.0.60.0082.37218.65
7.0.50.0072.21518.81
7.0.40.0102.24416.86
7.0.30.0052.25616.79
7.0.20.0082.17116.80
7.0.10.0032.14716.79
7.0.00.0052.19016.85
5.6.400.0002.49914.63
5.6.390.0032.49514.83
5.6.380.0072.49214.40
5.6.370.0032.49614.66
5.6.360.0002.49814.43
5.6.350.0072.49214.60
5.6.340.0032.49414.55
5.6.330.0002.49814.73
5.6.320.0002.49914.43
5.6.310.0002.49714.30
5.6.300.0132.48114.24
5.6.290.0032.49514.19
5.6.280.0022.49817.77
5.6.270.0002.49514.33
5.6.260.0072.49114.53
5.6.250.0072.49317.63
5.6.240.0032.49317.52
5.6.230.0072.49217.52
5.6.220.0052.49417.41
5.6.210.0032.49417.46
5.6.200.0052.49417.83
5.6.190.0082.49117.82
5.6.180.0052.49417.90
5.6.170.0072.49317.69
5.6.160.0052.49417.70
5.6.150.0072.49217.83
5.6.140.0032.49617.63
5.6.130.0022.49817.62
5.6.120.0002.49917.80
5.6.110.0082.49117.62
5.6.100.0072.49217.84
5.6.90.0052.49417.97
5.6.80.0122.48717.35
5.6.70.0032.49617.33
5.6.60.0022.49817.34
5.6.50.0122.48017.34
5.6.40.0052.49117.38
5.6.30.0072.49217.38
5.6.20.0072.49317.38
5.6.10.0032.49517.31
5.6.00.0022.49817.36
5.5.380.0072.44617.22
5.5.370.0182.42917.52
5.5.360.1532.34417.40
5.5.350.0222.44017.31
5.5.340.0132.45517.66
5.5.330.0082.46217.73
5.5.320.0082.49117.83
5.5.310.0122.46717.83
5.5.300.0132.47217.52
5.5.290.0122.46017.52
5.5.280.0222.45317.53
5.5.270.0032.49517.63
5.5.260.0032.49317.56
5.5.250.0052.49317.41
5.5.240.0122.45817.49
5.5.230.0102.47717.26
5.5.220.0032.49617.30
5.5.210.0052.49417.37
5.5.200.0052.49417.29
5.5.190.0052.49417.32
5.5.180.0102.48417.22
5.5.170.0072.46114.55
5.5.160.0032.48517.23
5.5.150.0032.47817.22
5.5.140.0002.48817.12
5.5.130.0032.47317.34
5.5.120.0102.46317.43
5.5.110.0172.43517.35
5.5.100.0002.49917.12
5.5.90.0032.49617.14
5.5.80.0132.45917.10
5.5.70.0072.46417.17
5.5.60.0022.49717.27
5.5.50.0082.48917.23
5.5.40.0122.43417.21
5.5.30.0122.48817.29
5.5.20.0152.45317.27
5.5.10.0052.49317.11
5.5.00.0212.45517.32
5.4.450.0002.49914.94
5.4.440.0032.49615.22
5.4.430.0032.49515.08
5.4.420.0082.49115.25
5.4.410.0072.46415.24
5.4.400.0022.49715.02
5.4.390.0052.49415.05
5.4.380.0172.44614.93
5.4.370.0132.44915.10
5.4.360.0052.49414.95
5.4.350.0052.46514.99
5.4.340.0082.49014.94
5.4.330.0072.49210.80
5.4.320.0182.44715.03
5.4.310.0152.46614.90
5.4.300.0052.49414.74
5.4.290.0002.49915.00
5.4.280.0032.49614.98
5.4.270.0152.43915.09
5.4.260.0102.48814.92
5.4.250.0122.45214.97
5.4.240.0032.49515.06
5.4.230.0032.49314.98
5.4.220.0072.48115.02
5.4.210.0152.44714.94
5.4.200.0052.48114.88
5.4.190.0082.49115.01
5.4.180.0032.46215.05
5.4.170.0052.46915.09
5.4.160.0032.49614.97
5.4.150.0032.49514.96
5.4.140.0032.42913.75
5.4.130.0032.49613.68
5.4.120.0122.45113.63
5.4.110.0202.45813.72
5.4.100.0032.49613.71
5.4.90.0072.47213.84
5.4.80.0132.40413.83
5.4.70.0132.45913.73
5.4.60.0022.47513.66
5.4.50.0152.46613.65
5.4.40.0052.47213.48
5.4.30.0072.47313.68
5.4.20.0032.48113.61
5.4.10.0052.47713.68
5.4.00.0172.46913.39
5.3.290.0122.45812.38
5.3.280.0202.44712.23
5.3.270.0122.45412.38
5.3.260.0032.49512.41
5.3.250.0032.49612.35
5.3.240.0072.49312.23
5.3.230.0122.45812.36
5.3.220.0052.49412.27
5.3.210.0082.45312.29
5.3.200.0152.46412.29
5.3.190.0052.49312.34
5.3.180.0032.49312.32
5.3.170.0082.46312.26
5.3.160.0072.48612.35
5.3.150.0052.47612.23
5.3.140.0152.45512.33
5.3.130.0132.45312.25
5.3.120.0032.46512.18
5.3.110.0122.47312.25
5.3.100.0032.48512.04
5.3.90.0122.45111.89
5.3.80.0082.49011.95
5.3.70.0102.46611.91
5.3.60.0052.49111.97
5.3.50.0082.44811.84
5.3.40.0182.45211.86
5.3.30.0132.47011.95
5.3.20.0072.49211.87
5.3.10.0122.47111.70
5.3.00.0052.49511.66
5.2.170.0102.49010.85
5.2.160.0172.43010.84
5.2.150.0132.43710.91
5.2.140.0002.50010.95
5.2.130.0102.48010.71
5.2.120.0132.44310.78
5.2.110.0002.50010.94
5.2.100.0032.45710.81
5.2.90.0102.49010.71
5.2.80.0102.45010.71
5.2.70.0002.44710.80
5.2.60.0102.44310.77
5.2.50.0132.44710.75
5.2.40.0072.49310.55
5.2.30.0102.43310.65
5.2.20.0102.49010.57
5.2.10.0172.27310.62
5.2.00.0072.44010.59
5.1.60.0070.3779.97
5.1.50.0070.3779.96
5.1.40.0070.3779.91
5.1.30.0130.37310.33
5.1.20.0000.33710.42
5.1.10.0070.34710.11
5.1.00.0070.31310.12
5.0.50.0030.5138.64
5.0.40.0070.5208.46
5.0.30.0030.5138.29
5.0.20.0030.5138.27
5.0.10.0030.5338.25
5.0.00.0100.5278.05
4.4.90.0000.0206.86
4.4.80.0000.0176.86
4.4.70.0030.0206.86
4.4.60.0000.0376.86
4.4.50.0070.0336.86
4.4.40.0070.0506.86
4.4.30.0030.0336.86
4.4.20.0030.0176.86
4.4.10.0030.0336.86
4.4.00.0000.0336.86
4.3.110.0000.0436.86
4.3.100.0030.0306.86
4.3.90.0000.0336.86
4.3.80.0030.0476.86
4.3.70.0000.0376.86
4.3.60.0030.0336.86
4.3.50.0000.0376.87
4.3.40.0000.0276.87
4.3.30.0000.0206.87
4.3.20.0000.0376.87
4.3.10.0130.0236.87
4.3.00.0070.0106.87

preferences:
38.78 ms | 401 KiB | 5 Q