3v4l.org

run code in 200+ 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>'; ?>

Abusive script

This script was stopped while abusing our resources

Output for 5.3.0 - 5.6.30, hhvm-3.10.1 - 3.17.3, 7.0.1 - 7.0.3, 7.0.5 - 7.0.9, 7.0.11 - 7.0.16, 7.0.20 - 7.1.1, 7.1.6 - 7.1.7
<pre>
Process exited with code 137.
Output for 7.1.5
<pre><pre>Single Run Array ( [m1] => 0.28547048568726 [m2] => 0.22514867782593 [m3] => 0.35690951347351 [m4] => 0.29640460014343 [m5] => 0.302809715271 [m6] => 0.2449312210083 [m7] => 0.38971352577209 [m8] => 0.33224320411682 ) </pre>
Output for 7.1.4
<pre><pre>Single Run Array ( [m1] => 0.26447319984436 [m2] => 0.21716976165771 [m3] => 0.33825087547302 [m4] => 0.28520226478577 [m5] => 0.29473900794983 [m6] => 0.2478768825531 [m7] => 0.38567495346069 [m8] => 0.32491111755371 ) </pre>
Output for 7.1.3
<pre><pre>Single Run Array ( [m1] => 0.26136779785156 [m2] => 0.21818995475769 [m3] => 0.34934282302856 [m4] => 0.28780007362366 [m5] => 0.29743552207947 [m6] => 0.24404311180115 [m7] => 0.36989116668701 [m8] => 0.31897306442261 ) </pre>
Output for 7.1.2
<pre><pre>Single Run Array ( [m1] => 0.27492499351501 [m2] => 0.22416162490845 [m3] => 0.34865140914917 [m4] => 0.28330087661743 [m5] => 0.30430340766907 [m6] => 0.24960732460022 [m7] => 0.3712043762207 [m8] => 0.31448316574097 ) </pre>
Output for 7.0.19
<pre><pre>Single Run Array ( [m1] => 0.27989268302917 [m2] => 0.22791171073914 [m3] => 0.35862255096436 [m4] => 0.3005747795105 [m5] => 0.31513428688049 [m6] => 0.25344324111938 [m7] => 0.38775157928467 [m8] => 0.33824419975281 ) </pre>
Output for 7.0.18
<pre><pre>Single Run Array ( [m1] => 0.25356817245483 [m2] => 0.21217584609985 [m3] => 0.32143568992615 [m4] => 0.27192234992981 [m5] => 0.28428053855896 [m6] => 0.23679685592651 [m7] => 0.36363887786865 [m8] => 0.30847573280334 ) </pre>
Output for 7.0.17
<pre><pre>Single Run Array ( [m1] => 0.27538847923279 [m2] => 0.22657823562622 [m3] => 0.35717749595642 [m4] => 0.30294990539551 [m5] => 0.30435395240784 [m6] => 0.25071406364441 [m7] => 0.37697243690491 [m8] => 0.32033443450928 ) </pre>
Output for 7.0.10
<pre><pre>Single Run Array ( [m1] => 0.25213599205017 [m2] => 0.21050786972046 [m3] => 0.31749749183655 [m4] => 0.26509523391724 [m5] => 0.28000998497009 [m6] => 0.23808121681213 [m7] => 0.34813261032104 [m8] => 0.29805588722229 ) </pre>
Output for 7.0.4
<pre><pre>Single Run Array ( [m1] => 0.26430678367615 [m2] => 0.21387887001038 [m3] => 0.33608174324036 [m4] => 0.28303670883179 [m5] => 0.29030299186707 [m6] => 0.23737096786499 [m7] => 0.35704040527344 [m8] => 0.3025324344635 ) </pre>
Output for 7.0.0
<pre><pre>Single Run Array ( [m1] => 0.26896238327026 [m2] => 0.21323609352112 [m3] => 0.33565950393677 [m4] => 0.28438711166382 [m5] => 0.29060387611389 [m6] => 0.23632407188416 [m7] => 0.35154056549072 [m8] => 0.31422805786133 ) </pre>