3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // Start set_time_limit(0); echo "<pre>"; // Normal Recusion function m1($num) { return $num === 0 ? 1 : $num * m1($num - 1); } // Tail Recusion function m2($num) { return m2Helper($num, 1); } // Tail Recusion Helper function m2Helper($num, $acc) { return $num === 0 ? $acc : m2($num - 1, $acc * $num); } $result = array('m1' => 0,'m2' => 0); $no = 10; for($i = 0; $i < 1; ++ $i) { foreach ( array_keys($result) as $key ) { $alpha = microtime(true); $key($no); $result[$key] += microtime(true) - $alpha; } } echo '<pre>'; echo "Single Run\n"; print_r($result); echo '</pre>'; ?>
Output for 7.0.1, 7.1.0
<pre><pre>Single Run Array ( [m1] => 3.0994415283203E-6 [m2] => 2.1457672119141E-6 ) </pre>
Output for 7.0.4, 7.0.14
<pre><pre>Single Run Array ( [m1] => 4.0531158447266E-6 [m2] => 3.0994415283203E-6 ) </pre>
Output for 7.0.6
<pre><pre>Single Run Array ( [m1] => 5.9604644775391E-6 [m2] => 6.9141387939453E-6 ) </pre>
Output for 7.0.5
<pre><pre>Single Run Array ( [m1] => 3.0994415283203E-6 [m2] => 4.0531158447266E-6 ) </pre>
Output for 7.0.3
<pre><pre>Single Run Array ( [m1] => 3.0994415283203E-6 [m2] => 2.8610229492188E-6 ) </pre>
Output for 7.0.2
<pre><pre>Single Run Array ( [m1] => 4.0531158447266E-6 [m2] => 1.9073486328125E-6 ) </pre>
Output for 7.0.0
<pre><pre>Single Run Array ( [m1] => 3.814697265625E-6 [m2] => 1.9073486328125E-6 ) </pre>
Output for 5.4.42, 5.5.35, hhvm-3.12.0
<pre><pre>Single Run Array ( [m1] => 6.9141387939453E-6 [m2] => 4.0531158447266E-6 ) </pre>
Output for 5.3.20, 5.4.8, 5.4.31, hhvm-3.10.0
<pre><pre>Single Run Array ( [m1] => 5.9604644775391E-6 [m2] => 5.0067901611328E-6 ) </pre>
Output for 5.3.7, 5.6.28
<pre><pre>Single Run Array ( [m1] => 1.0013580322266E-5 [m2] => 8.1062316894531E-6 ) </pre>
Output for 5.3.8, 5.3.27, 5.3.29, 5.4.3, 5.4.5, 5.4.15, 5.4.19, 5.4.28 - 5.4.29, 5.5.26, 5.6.10, 5.6.21
<pre><pre>Single Run Array ( [m1] => 9.0599060058594E-6 [m2] => 5.9604644775391E-6 ) </pre>
Output for 5.4.1, 5.4.12, 5.4.30, 5.6.20
<pre><pre>Single Run Array ( [m1] => 9.0599060058594E-6 [m2] => 6.1988830566406E-6 ) </pre>
Output for 5.3.15, 5.4.39, 5.6.19
<pre><pre>Single Run Array ( [m1] => 1.0013580322266E-5 [m2] => 5.9604644775391E-6 ) </pre>
Output for 5.4.4, 5.4.22, 5.4.43, 5.6.15, 5.6.18
<pre><pre>Single Run Array ( [m1] => 8.1062316894531E-6 [m2] => 5.9604644775391E-6 ) </pre>
Output for 5.6.12, 5.6.17
<pre><pre>Single Run Array ( [m1] => 8.8214874267578E-6 [m2] => 6.9141387939453E-6 ) </pre>
Output for 5.6.16
<pre><pre>Single Run Array ( [m1] => 1.4066696166992E-5 [m2] => 5.9604644775391E-6 ) </pre>
Output for 5.5.24, 5.6.14
<pre><pre>Single Run Array ( [m1] => 6.1988830566406E-6 [m2] => 4.0531158447266E-6 ) </pre>
Output for 5.3.1, 5.4.35, 5.5.32, 5.6.13
<pre><pre>Single Run Array ( [m1] => 6.9141387939453E-6 [m2] => 5.0067901611328E-6 ) </pre>
Output for 5.4.10, 5.4.27, 5.4.36, 5.5.28, 5.6.11
<pre><pre>Single Run Array ( [m1] => 7.8678131103516E-6 [m2] => 5.9604644775391E-6 ) </pre>
Output for 5.4.44, 5.6.9
<pre><pre>Single Run Array ( [m1] => 1.0013580322266E-5 [m2] => 7.1525573730469E-6 ) </pre>
Output for 5.4.45, 5.6.8
<pre><pre>Single Run Array ( [m1] => 1.1920928955078E-5 [m2] => 8.8214874267578E-6 ) </pre>
Output for 5.5.34
<pre><pre>Single Run Array ( [m1] => 1.2874603271484E-5 [m2] => 8.8214874267578E-6 ) </pre>
Output for 5.5.33
<pre><pre>Single Run Array ( [m1] => 1.3113021850586E-5 [m2] => 1.0967254638672E-5 ) </pre>
Output for 5.5.31
<pre><pre>Single Run Array ( [m1] => 8.1062316894531E-6 [m2] => 4.7683715820312E-6 ) </pre>
Output for 5.5.30
<pre><pre>Single Run Array ( [m1] => 1.3113021850586E-5 [m2] => 9.0599060058594E-6 ) </pre>
Output for 5.5.29
<pre><pre>Single Run Array ( [m1] => 6.9141387939453E-6 [m2] => 3.814697265625E-6 ) </pre>
Output for 5.4.38, 5.5.27
<pre><pre>Single Run Array ( [m1] => 7.1525573730469E-6 [m2] => 5.0067901611328E-6 ) </pre>
Output for 5.5.25
<pre><pre>Single Run Array ( [m1] => 1.0967254638672E-5 [m2] => 8.1062316894531E-6 ) </pre>
Output for 5.4.41
<pre><pre>Single Run Array ( [m1] => 5.0067901611328E-6 [m2] => 3.814697265625E-6 ) </pre>
Output for 5.3.0, 5.4.2, 5.4.17, 5.4.40
<pre><pre>Single Run Array ( [m1] => 9.0599060058594E-6 [m2] => 6.9141387939453E-6 ) </pre>
Output for 5.3.3, 5.4.37
<pre><pre>Single Run Array ( [m1] => 7.8678131103516E-6 [m2] => 5.0067901611328E-6 ) </pre>
Output for 5.4.34
<pre><pre>Single Run Array ( [m1] => 8.1062316894531E-6 [m2] => 5.0067901611328E-6 ) </pre>
Output for 5.4.7, 5.4.9, 5.4.32
<pre><pre>Single Run Array ( [m1] => 5.9604644775391E-6 [m2] => 3.814697265625E-6 ) </pre>
Output for 5.4.16, 5.4.26
<pre><pre>Single Run Array ( [m1] => 1.0967254638672E-5 [m2] => 8.8214874267578E-6 ) </pre>
Output for 5.4.25
<pre><pre>Single Run Array ( [m1] => 7.1525573730469E-6 [m2] => 3.814697265625E-6 ) </pre>
Output for 5.4.24
<pre><pre>Single Run Array ( [m1] => 1.1920928955078E-5 [m2] => 1.0013580322266E-5 ) </pre>
Output for 5.3.6, 5.3.24, 5.3.28, 5.4.23
<pre><pre>Single Run Array ( [m1] => 9.0599060058594E-6 [m2] => 8.1062316894531E-6 ) </pre>
Output for 5.3.12, 5.4.6, 5.4.21
<pre><pre>Single Run Array ( [m1] => 1.0967254638672E-5 [m2] => 9.0599060058594E-6 ) </pre>
Output for 5.4.20
<pre><pre>Single Run Array ( [m1] => 1.5020370483398E-5 [m2] => 1.0013580322266E-5 ) </pre>
Output for 5.3.4, 5.3.9 - 5.3.10, 5.4.18
<pre><pre>Single Run Array ( [m1] => 9.0599060058594E-6 [m2] => 7.1525573730469E-6 ) </pre>
Output for 5.4.14
<pre><pre>Single Run Array ( [m1] => 1.0967254638672E-5 [m2] => 1.0013580322266E-5 ) </pre>
Output for 5.4.13
<pre><pre>Single Run Array ( [m1] => 5.0067901611328E-6 [m2] => 5.0067901611328E-6 ) </pre>
Output for 5.4.11
<pre><pre>Single Run Array ( [m1] => 8.8214874267578E-6 [m2] => 5.9604644775391E-6 ) </pre>
Output for 5.4.0
<pre><pre>Single Run Array ( [m1] => 5.9604644775391E-6 [m2] => 4.0531158447266E-6 ) </pre>
Output for 5.3.26
<pre><pre>Single Run Array ( [m1] => 6.9141387939453E-6 [m2] => 5.9604644775391E-6 ) </pre>
Output for 5.3.25
<pre><pre>Single Run Array ( [m1] => 9.0599060058594E-6 [m2] => 9.0599060058594E-6 ) </pre>
Output for 5.3.23
<pre><pre>Single Run Array ( [m1] => 6.9141387939453E-6 [m2] => 6.1988830566406E-6 ) </pre>
Output for 5.3.22
<pre><pre>Single Run Array ( [m1] => 1.5020370483398E-5 [m2] => 6.9141387939453E-6 ) </pre>
Output for 5.3.21
<pre><pre>Single Run Array ( [m1] => 1.0013580322266E-5 [m2] => 6.9141387939453E-6 ) </pre>
Output for 5.3.17, 5.3.19
<pre><pre>Single Run Array ( [m1] => 7.8678131103516E-6 [m2] => 6.9141387939453E-6 ) </pre>
Output for 5.3.18
<pre><pre>Single Run Array ( [m1] => 8.1062316894531E-6 [m2] => 9.0599060058594E-6 ) </pre>
Output for 5.3.16
<pre><pre>Single Run Array ( [m1] => 1.215934753418E-5 [m2] => 9.0599060058594E-6 ) </pre>
Output for 5.3.14
<pre><pre>Single Run Array ( [m1] => 8.8214874267578E-6 [m2] => 7.8678131103516E-6 ) </pre>
Output for 5.3.13
<pre><pre>Single Run Array ( [m1] => 8.1062316894531E-6 [m2] => 6.9141387939453E-6 ) </pre>
Output for 5.3.11
<pre><pre>Single Run Array ( [m1] => 1.1920928955078E-5 [m2] => 9.0599060058594E-6 ) </pre>
Output for 5.3.5
<pre><pre>Single Run Array ( [m1] => 9.0599060058594E-6 [m2] => 7.8678131103516E-6 ) </pre>
Output for 5.3.2
<pre><pre>Single Run Array ( [m1] => 1.4066696166992E-5 [m2] => 1.215934753418E-5 ) </pre>
Output for 5.2.17
<pre><pre>Single Run Array ( [m1] => 8.8214874267578E-6 [m2] => 1.1920928955078E-5 ) </pre>
Output for 5.2.16
<pre><pre>Single Run Array ( [m1] => 1.5020370483398E-5 [m2] => 2.0980834960938E-5 ) </pre>
Output for 5.2.15
<pre><pre>Single Run Array ( [m1] => 7.8678131103516E-6 [m2] => 8.8214874267578E-6 ) </pre>
Output for 5.2.14
<pre><pre>Single Run Array ( [m1] => 7.8678131103516E-6 [m2] => 1.0013580322266E-5 ) </pre>
Output for 5.2.13
<pre><pre>Single Run Array ( [m1] => 9.0599060058594E-6 [m2] => 1.1920928955078E-5 ) </pre>
Output for 5.2.12
<pre><pre>Single Run Array ( [m1] => 7.8678131103516E-6 [m2] => 1.0967254638672E-5 ) </pre>
Output for 5.2.11
<pre><pre>Single Run Array ( [m1] => 8.8214874267578E-6 [m2] => 1.3828277587891E-5 ) </pre>
Output for 5.2.10
<pre><pre>Single Run Array ( [m1] => 1.0013580322266E-5 [m2] => 1.4066696166992E-5 ) </pre>
Output for 5.2.8 - 5.2.9
<pre><pre>Single Run Array ( [m1] => 6.9141387939453E-6 [m2] => 1.0013580322266E-5 ) </pre>
Output for 5.2.7
<pre><pre>Single Run Array ( [m1] => 5.0067901611328E-6 [m2] => 7.8678131103516E-6 ) </pre>
Output for 5.2.6
<pre><pre>Single Run Array ( [m1] => 8.1062316894531E-6 [m2] => 1.1920928955078E-5 ) </pre>
Output for 5.2.5
<pre><pre>Single Run Array ( [m1] => 5.9604644775391E-6 [m2] => 9.7751617431641E-6 ) </pre>
Output for 5.2.4
<pre><pre>Single Run Array ( [m1] => 7.1525573730469E-6 [m2] => 1.0967254638672E-5 ) </pre>
Output for 5.2.3
<pre><pre>Single Run Array ( [m1] => 1.0967254638672E-5 [m2] => 1.6212463378906E-5 ) </pre>
Output for 5.2.2
<pre><pre>Single Run Array ( [m1] => 9.0599060058594E-6 [m2] => 1.3113021850586E-5 ) </pre>
Output for 5.2.1
<pre><pre>Single Run Array ( [m1] => 7.8678131103516E-06 [m2] => 1.2874603271484E-05 ) </pre>
Output for 5.2.0
<pre><pre>Single Run Array ( [m1] => 9.0599060058594E-06 [m2] => 1.5020370483398E-05 ) </pre>
Output for 5.1.6
<pre><pre>Single Run Array ( [m1] => 1.5020370483398E-05 [m2] => 2.288818359375E-05 ) </pre>
Output for 5.1.5
<pre><pre>Single Run Array ( [m1] => 1.4066696166992E-05 [m2] => 2.2172927856445E-05 ) </pre>
Output for 5.1.4
<pre><pre>Single Run Array ( [m1] => 1.3113021850586E-05 [m2] => 2.8133392333984E-05 ) </pre>
Output for 5.1.3
<pre><pre>Single Run Array ( [m1] => 8.1062316894531E-06 [m2] => 1.0967254638672E-05 ) </pre>
Output for 5.1.2
<pre><pre>Single Run Array ( [m1] => 1.0967254638672E-05 [m2] => 2.3841857910156E-05 ) </pre>
Output for 5.1.1
<pre><pre>Single Run Array ( [m1] => 1.1205673217773E-05 [m2] => 1.6927719116211E-05 ) </pre>
Output for 5.1.0
<pre><pre>Single Run Array ( [m1] => 9.0599060058594E-06 [m2] => 1.7881393432617E-05 ) </pre>
Output for 5.0.5
<pre><pre>Single Run Array ( [m1] => 1.0013580322266E-05 [m2] => 1.8835067749023E-05 ) </pre>
Output for 5.0.4
<pre><pre>Single Run Array ( [m1] => 2.5033950805664E-05 [m2] => 3.1948089599609E-05 ) </pre>
Output for 5.0.3
<pre><pre>Single Run Array ( [m1] => 1.3113021850586E-05 [m2] => 2.0027160644531E-05 ) </pre>
Output for 5.0.2
<pre><pre>Single Run Array ( [m1] => 1.5020370483398E-05 [m2] => 2.9087066650391E-05 ) </pre>
Output for 5.0.1
<pre><pre>Single Run Array ( [m1] => 1.4066696166992E-05 [m2] => 2.5033950805664E-05 ) </pre>
Output for 5.0.0
<pre><pre>Single Run Array ( [m1] => 1.7166137695312E-05 [m2] => 2.4080276489258E-05 ) </pre>
Output for 4.4.9
<pre><pre>Single Run Array ( [m1] => 1.8000000000018E-05 [m2] => 2.1999999999994E-05 ) </pre>
Output for 4.4.8
<pre><pre>Single Run Array ( [m1] => 4.9000000000021E-05 [m2] => 4.3999999999988E-05 ) </pre>
Output for 4.4.7
<pre><pre>Single Run Array ( [m1] => 3.9000000000011E-05 [m2] => 4.3000000000015E-05 ) </pre>
Output for 4.4.6
<pre><pre>Single Run Array ( [m1] => 3.7999999999982E-05 [m2] => 3.000000000003E-05 ) </pre>
Output for 4.4.5
<pre><pre>Single Run Array ( [m1] => 3.3999999999978E-05 [m2] => 4.3000000000015E-05 ) </pre>
Output for 4.4.4
<pre><pre>Single Run Array ( [m1] => 3.1999999999921E-05 [m2] => 2.6999999999999E-05 ) </pre>
Output for 4.4.3
<pre><pre>Single Run Array ( [m1] => 2.2999999999995E-05 [m2] => 2.7999999999917E-05 ) </pre>
Output for 4.4.2
<pre><pre>Single Run Array ( [m1] => 3.5000000000007E-05 [m2] => 4.5000000000073E-05 ) </pre>
Output for 4.4.1
<pre><pre>Single Run Array ( [m1] => 3.6999999999995E-05 [m2] => 4.0999999999999E-05 ) </pre>
Output for 4.4.0
<pre><pre>Single Run Array ( [m1] => 3.7000000000009E-05 [m2] => 5.0999999999995E-05 ) </pre>
Output for 4.3.11
<pre><pre>Single Run Array ( [m1] => 4.2000000000042E-05 [m2] => 5.299999999997E-05 ) </pre>
Output for 4.3.10
<pre><pre>Single Run Array ( [m1] => 3.3999999999978E-05 [m2] => 2.9000000000001E-05 ) </pre>
Output for 4.3.9
<pre><pre>Single Run Array ( [m1] => 2.000000000002E-05 [m2] => 2.3999999999968E-05 ) </pre>
Output for 4.3.8
<pre><pre>Single Run Array ( [m1] => 2.000000000002E-05 [m2] => 2.1999999999966E-05 ) </pre>
Output for 4.3.7
<pre><pre>Single Run Array ( [m1] => 2.0999999999938E-05 [m2] => 2.4000000000024E-05 ) </pre>
Output for 4.3.6
<pre><pre>Single Run Array ( [m1] => 2.6999999999999E-05 [m2] => 1.6000000000016E-05 ) </pre>
Output for 4.3.5
<pre><pre>Single Run Array ( [m1] => 2.6999999999999E-05 [m2] => 4.000000000004E-05 ) </pre>
Output for 4.3.4
<pre><pre>Single Run Array ( [m1] => 2.2999999999995E-05 [m2] => 2.8000000000028E-05 ) </pre>
Output for 4.3.3
<pre><pre>Single Run Array ( [m1] => 2.3000000000002E-05 [m2] => 4.0999999999999E-05 ) </pre>
Output for 4.3.2
<pre><pre>Single Run Array ( [m1] => 4.1000000000013E-05 [m2] => 4.800000000002E-05 ) </pre>
Output for 4.3.1
<pre><pre>Single Run Array ( [m1] => 2.6999999999999E-05 [m2] => 2.9000000000001E-05 ) </pre>
Output for 4.3.0
<pre><pre>Single Run Array ( [m1] => 2.3999999999968E-05 [m2] => 2.9000000000001E-05 ) </pre>