3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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>'; ?>
Output for 7.1.0
<pre><pre>Single Run Array ( [m1] => 0.25839257240295 [m2] => 0.18118858337402 [m3] => 0.30062294006348 [m4] => 0.26477575302124 [m5] => 0.28299188613892 [m6] => 0.20424914360046 [m7] => 0.31607389450073 [m8] => 0.26907181739807 ) </pre>
Output for 7.0.14
<pre><pre>Single Run Array ( [m1] => -0.16565132141113 [m2] => 1.6415691375732 [m3] => -0.21915340423584 [m4] => -0.19361710548401 [m5] => -0.18977427482605 [m6] => -0.16193675994873 [m7] => 1.542876958847 [m8] => -0.207439661026 ) </pre>
Output for 7.0.6
<pre><pre>Single Run Array ( [m1] => 0.24539756774902 [m2] => 0.20358300209045 [m3] => 0.35448718070984 [m4] => 0.25814294815063 [m5] => 0.27177858352661 [m6] => 0.22796416282654 [m7] => 0.38357734680176 [m8] => 0.28539729118347 ) </pre>
Output for 7.0.5
<pre><pre>Single Run Array ( [m1] => 0.24833655357361 [m2] => 0.20850992202759 [m3] => 0.35899686813354 [m4] => 0.26359987258911 [m5] => 0.27548336982727 [m6] => 0.23474168777466 [m7] => 0.38615322113037 [m8] => 0.29594659805298 ) </pre>
Output for 7.0.4
<pre><pre>Single Run Array ( [m1] => 0.24789762496948 [m2] => 0.20484304428101 [m3] => 0.31503629684448 [m4] => 0.26309657096863 [m5] => 0.2806990146637 [m6] => 0.23536682128906 [m7] => 0.34645628929138 [m8] => 0.29051041603088 ) </pre>
Output for 5.2.14 - 5.6.28, 7.0.3
<pre>
Process exited with code 137.
Output for 7.0.2
<pre><pre>Single Run Array ( [m1] => 0.25289535522461 [m2] => 0.20597624778748 [m3] => 0.35787487030029 [m4] => 0.26173543930054 [m5] => 0.27919578552246 [m6] => 0.22934508323669 [m7] => 0.38822150230408 [m8] => 0.28691911697388 ) </pre>
Output for 7.0.1
<pre><pre>Single Run Array ( [m1] => 0.24825716018677 [m2] => 0.20538020133972 [m3] => 0.36390542984009 [m4] => 0.26435303688049 [m5] => 0.27620005607605 [m6] => 0.23278880119324 [m7] => 0.39236545562744 [m8] => 0.29207754135132 ) </pre>
Output for 7.0.0
<pre><pre>Single Run Array ( [m1] => 0.24285507202148 [m2] => 0.20224905014038 [m3] => 0.35679411888123 [m4] => 0.2573094367981 [m5] => 0.27168107032776 [m6] => 0.22847747802734 [m7] => 0.38272953033447 [m8] => 0.2826030254364 ) </pre>