3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '1|27|31|33'; $separator = '##|##'; $time = microtime(true); var_dump($time); for ($i = 0; $i < 100000; $i++) { $result = str_replace('|', $separator, $input); } $time = microtime(true); var_dump($time); for ($i = 0; $i < 100000; $i++) { $result = ''; $it = new CachingIterator(new ArrayIterator(explode('|', $input)), CachingIterator::FULL_CACHE); foreach ($it as $categoryId) { $result .= $categoryId; if ($it->hasNext()) { $result .= $separator; } } } $time = microtime(true); var_dump($time);

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.60.0070.18316.80
7.2.00.0070.20319.38
7.1.100.0030.21618.23
7.1.70.0070.20017.16
7.1.60.0070.21719.82
7.1.50.0030.26616.95
7.1.00.0030.34722.30
7.0.200.0740.25716.47
7.0.140.0100.34322.14
7.0.70.0870.27319.93
7.0.60.0870.29019.95
7.0.50.0970.30720.25
7.0.40.0130.32320.04
7.0.30.0030.22720.10
7.0.20.0030.26720.14
7.0.10.0030.28320.15
7.0.00.0170.32720.08
5.6.280.0070.49020.81
5.6.220.0100.47720.67
5.6.210.0070.44020.45
5.6.200.0130.48321.04
5.6.190.0170.48021.03
5.6.180.0100.45721.17
5.6.170.0130.42721.08
5.6.160.0100.45021.08
5.6.150.0000.40021.10
5.6.140.0100.45321.11
5.6.130.0100.40021.17
5.6.120.0100.41721.01
5.6.110.0100.40020.94
5.6.100.0100.44021.00
5.6.90.0070.33020.93
5.6.80.0100.44020.48
5.6.70.0100.46020.43
5.6.60.0070.47020.46
5.6.50.0130.44020.41
5.6.40.0170.39320.30
5.6.30.0670.43720.33
5.6.20.0100.37320.27
5.6.10.0070.44720.37
5.6.00.0100.44320.47
5.5.360.0070.47720.44
5.5.350.0130.41720.46
5.5.340.0130.48720.77
5.5.330.0070.44020.80
5.5.320.0130.44020.89
5.5.310.0130.44320.89
5.5.300.0070.45320.90
5.5.290.0030.39020.88
5.5.280.0100.46320.91
5.5.270.0100.47020.83
5.5.260.0000.37020.85
5.5.250.0030.35320.57
5.5.240.0070.48720.25
5.5.230.0070.46020.15
5.5.220.0130.46020.19
5.5.210.0070.44320.23
5.5.200.0070.45719.99
5.5.190.0100.43720.08
5.5.180.0070.42320.15
5.5.160.0100.38720.18
5.5.150.0030.46320.23
5.5.140.0200.42720.25
5.5.130.0130.46020.21
5.5.120.0230.46020.25
5.5.110.0070.43020.22
5.5.100.0170.45020.15
5.5.90.0130.43320.14
5.5.80.0070.45319.94
5.5.70.0100.44720.05
5.5.60.0030.44319.91
5.5.50.0070.40320.00
5.5.40.0030.42320.04
5.5.30.0100.43020.04
5.5.20.0070.42319.92
5.5.10.0100.43020.05
5.5.00.0130.38720.06
5.4.450.0030.31019.40
5.4.440.0070.45719.44
5.4.430.0430.41319.39
5.4.420.0000.38719.38
5.4.410.0030.41719.24
5.4.400.0070.39019.03
5.4.390.0130.45319.10
5.4.380.0070.44318.98
5.4.370.0070.41719.05
5.4.360.0100.44718.98
5.4.350.0030.43018.98
5.4.340.0070.36018.98
5.4.320.0100.49019.14
5.4.310.0030.44719.02
5.4.300.0130.41319.07
5.4.290.0070.38319.14
5.4.280.0100.42319.14
5.4.270.0070.42019.11
5.4.260.0030.46019.04
5.4.250.0070.44718.98
5.4.240.0070.44019.00
5.4.230.0070.42318.95
5.4.220.0030.38019.11
5.4.210.0130.45319.09
5.4.200.0070.47319.05
5.4.190.0130.45718.78
5.4.180.0100.35319.03
5.4.170.0030.42018.88
5.4.160.0030.39718.88
5.4.150.0070.43719.09
5.4.140.0030.44316.27
5.4.130.0000.39716.33
5.4.120.0070.44316.26
5.4.110.0030.38316.36
5.4.100.0030.44016.34
5.4.90.0130.42716.21
5.4.80.0100.46316.25
5.4.70.0130.44016.21
5.4.60.0000.43016.38
5.4.50.0070.43316.33
5.4.40.0070.42716.47
5.4.30.0070.39316.19
5.4.20.0000.36316.27
5.4.10.0000.31316.27
5.4.00.0100.39315.79
5.3.290.0100.49314.67
5.3.280.0100.56314.53
5.3.270.0100.49714.45
5.3.260.0070.50714.59
5.3.250.0070.52014.52
5.3.240.0100.52014.46
5.3.230.0100.53314.60
5.3.220.0030.50014.53
5.3.210.0030.49314.51
5.3.200.0070.51014.43
5.3.190.0100.52014.48
5.3.180.0130.49014.39
5.3.170.0030.50714.55
5.3.160.0030.51314.51
5.3.150.0030.47314.43
5.3.140.0070.51014.47
5.3.130.0470.52314.46
5.3.120.0070.53714.52
5.3.110.0030.43314.54
5.3.100.0130.45714.00
5.3.90.0030.40014.00
5.3.80.0030.42313.88
5.3.70.0000.40713.88
5.3.60.0070.37713.99
5.3.50.0030.39013.95
5.3.40.0030.48013.70
5.3.30.0100.39013.82
5.3.20.0000.51013.68
5.3.10.0030.50013.43
5.3.00.0000.50013.63
5.2.170.0030.43312.23
5.2.160.0070.46012.23
5.2.150.0070.41712.23
5.2.140.0000.49312.23
5.2.130.0070.50712.23
5.2.120.0130.42312.23
5.2.110.0000.49012.23
5.2.100.0070.49312.23
5.2.90.0030.49012.23
5.2.80.0030.46712.23
5.2.70.0030.50012.23
5.2.60.0100.49012.23
5.2.50.0030.47712.23
5.2.40.0100.53012.23
5.2.30.0030.47712.23
5.2.20.0000.50312.23
5.2.10.0030.49712.23
5.2.00.0000.47012.23
5.1.60.0030.10012.23
5.1.50.0000.10312.23
5.1.40.0000.07312.23
5.1.30.0030.10712.23
5.1.20.0100.09312.23
5.1.10.0030.08712.23
5.1.00.0100.10312.23
5.0.50.0100.07012.23
5.0.40.0030.06712.23
5.0.30.0000.10312.23
5.0.20.0030.11712.23
5.0.10.0030.10012.23
5.0.00.0030.13712.23
4.4.90.0070.03712.23
4.4.80.0000.02012.23
4.4.70.0000.03712.23
4.4.60.0000.03712.23
4.4.50.0030.03712.23
4.4.40.0030.05312.23
4.4.30.0030.02012.23
4.4.20.0000.04012.23
4.4.10.0070.01712.23
4.4.00.0030.05312.23
4.3.110.0000.03312.23
4.3.100.0030.02312.23
4.3.90.0030.03012.23
4.3.80.0030.04712.23
4.3.70.0000.03012.23
4.3.60.0000.03712.23
4.3.50.0000.03012.23
4.3.40.0000.04312.23
4.3.30.0000.03712.23
4.3.20.0030.03712.23
4.3.10.0000.03312.23
4.3.00.0030.02312.23

preferences:
39.13 ms | 401 KiB | 5 Q