3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* How many times the code under test should run in each function */ define('LOOP',1000000); function f1() { for($i=0; $i<LOOP; ++$i) { str_replace('_', '-', 'parse-url-without-regular-expression'); } } function f2() { for($i=0; $i<LOOP; ++$i) { preg_replace('/_/', '-', 'parse-url-without-regular-expression'); } } $start = microtime(true); f1(); $stop = microtime(true); $time1 = $stop - $start; $start = microtime(true); f2(); $stop = microtime(true); $time2 = $stop - $start; echo $time1 . "\t"; echo $time2 . "\n";

preferences:
33.34 ms | 402 KiB | 5 Q