3v4l.org

run code in 300+ PHP versions simultaneously
<?php $values = []; const ITERATIONS = 100000; $start = microtime(true); for ($i = 0; $i < ITERATIONS; $i++) { strtr('1_000_000', ['_' => '']); strtr('1000000', ['_' => '']); } $values['strtr'] = microtime(true) - $start; $start = microtime(true); for ($i = 0; $i < ITERATIONS; $i++) { str_replace('_', '', '1_000_000'); str_replace('_', '', '1000000'); } $values['str_replace'] = (microtime(true) - $start); asort($values); echo array_key_first($values). "\n"; foreach ($values as $key => $val) { // echo "\n".str_pad($key, 14, ' ') . number_format($val * 1000 / ITERATIONS, 5) . " ms / k"; }

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.4.10.0460.03017.11
8.3.140.0260.01916.45
8.3.130.0130.01916.38
8.3.120.0160.01616.46
8.3.110.0200.03615.99
8.3.100.0420.03516.10
8.3.90.0310.03916.20
8.3.80.0390.03516.32
8.3.70.0240.02116.27
8.3.60.0240.03716.34
8.3.50.0150.04816.18
8.3.40.0140.01817.53
8.3.30.0090.02017.52
8.3.20.0100.01917.55
8.3.10.0090.02017.69
8.3.00.0090.01317.52
8.2.260.0160.01916.14
8.2.250.0340.02516.23
8.2.240.0150.01516.68
8.2.230.0130.01716.55
8.2.220.0160.03916.57
8.2.210.0170.03816.39
8.2.200.0310.03116.45
8.2.190.0300.03016.55
8.2.180.0130.01616.55
8.2.170.0270.01817.70
8.2.160.0300.03017.44
8.2.150.0110.02117.56
8.2.140.0270.03017.33
8.2.130.0230.03917.45
8.2.120.0310.03817.27
8.2.110.0240.03117.62
8.2.100.0160.01617.50
8.2.90.0350.03817.41
8.2.80.0370.03717.27
8.2.70.0300.03617.53
8.2.60.0110.01817.57
8.2.50.0150.01517.54
8.2.40.0260.03717.60
8.2.30.0150.01517.43
8.2.20.0280.03517.47
8.2.10.0210.03217.46
8.2.00.0220.03617.64

preferences:
26.98 ms | 402 KiB | 5 Q