3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_time_limit(0); echo "<pre>"; function m1($total) { for($i = 0; $i < $total; $i ++) hash('md5', 'string'); } function m2($total) { for($i = 0; $i < $total; $i ++) md5('string'); } function m3($total) { for($i = 0; $i < $total; $i ++) hash('sha1', 'string'); } function m4($total) { for($i = 0; $i < $total; $i ++) sha1('string'); } function m5($total) { for($i = 0; $i < $total; $i ++) hash('md5', $i); } function m6($total) { for($i = 0; $i < $total; $i ++) md5($i); } function m7($total) { for($i = 0; $i < $total; $i ++) hash('sha1', $i); } function m8($total) { for($i = 0; $i < $total; $i ++) sha1($i); } $result = array( 'm1' => 0, 'm2' => 0, 'm3' => 0, 'm4' => 0, 'm5' => 0, 'm6' => 0, 'm7' => 0, 'm8' => 0 ); $total = 10000; for($i = 0; $i < 100; ++ $i) { foreach ( array_keys($result) as $key ) { $alpha = microtime(true); $key($total); $result[$key] += microtime(true) - $alpha; } } echo '<pre>'; echo "Single Run\n"; print_r($result); echo '</pre>'; ?>

preferences:
36.04 ms | 402 KiB | 5 Q