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"; }

preferences:
24.29 ms | 408 KiB | 5 Q