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"; }
Output for git.master_jit
str_replace
Output for git.master
strtr

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
25.93 ms | 406 KiB | 5 Q