3v4l.org

run code in 300+ PHP versions simultaneously
<?php $startTimeOne = microtime(true); for ($i = 0; $i <= 10000; $i++) { str_replace('-', '+', 'my-name-is-am-and-i-like-trains'); } $endTimeOne = microtime(true); for ($j = 0; $j <= 10000; $j++) { str_replace('-', '+', 'foo-bar'); } $endTimeTwo = microtime(true); for ($j = 0; $j <= 10000; $j++) { preg_replace('#-#', '+', 'my-name-is-am-and-i-like-trains'); } $endTimeThree = microtime(true); for ($j = 0; $j <= 10000; $j++) { preg_replace('#-#', '+', 'foo-bar'); } $endTimeFour = microtime(true); echo ($endTimeOne - $startTimeOne) * 1000 . "\n"; echo ($endTimeTwo - $endTimeOne) * 1000 . "\n"; echo ($endTimeThree - $endTimeTwo) * 1000 . "\n"; echo ($endTimeFour - $endTimeThree) * 1000;

preferences:
26.05 ms | 406 KiB | 5 Q