3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $classmap1 = array(); for ($i=1; $i<=5000; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=5000; $i++) { $classmap2['b'.$i] = $i+1; } abstract class merging { public static function merge(array &$a, array &$b) { foreach ($b as $key => $value) { if (isset($a[$key])) { if (is_int($key)) { $a[] = $value; } elseif (is_array($value) && is_array($a[$key])) { $a[$key] = static::merge($a[$key], $value); } else { $a[$key] = $value; } } else { $a[$key] = $value; } } return $a; } } $startTimeFunc = microtime(true); merging::merge($classmap1, $classmap2); $endTimeFunc = microtime(true); echo "Func took " . (($endTimeFunc - $startTimeFunc)*1000) ." microseconds<br />\n";
Output for 7.1.0
Func took 0.61917304992676 microseconds<br />
Output for 7.0.14
Func took 0.60391426086426 microseconds<br />
Output for 7.0.6
Func took 0.63395500183105 microseconds<br />
Output for 7.0.5
Func took 0.56314468383789 microseconds<br />
Output for 7.0.4
Func took 0.55885314941406 microseconds<br />
Output for 7.0.3
Func took 0.47397613525391 microseconds<br />
Output for 7.0.2
Func took 0.54597854614258 microseconds<br />
Output for 7.0.1
Func took 0.7171630859375 microseconds<br />
Output for 7.0.0
Func took 0.46014785766602 microseconds<br />
Output for hhvm-3.12.0
Func took 0.68378448486328 microseconds<br />
Output for hhvm-3.10.0
Func took 0.77509880065918 microseconds<br />
Output for 5.6.28
Func took 1.4879703521729 microseconds<br />
Output for 5.4.11, 5.6.21
Func took 1.4679431915283 microseconds<br />
Output for 5.6.20
Func took 1.7240047454834 microseconds<br />
Output for 5.6.19
Func took 0.89097023010254 microseconds<br />
Output for 5.6.18
Func took 0.9160041809082 microseconds<br />
Output for 5.6.17
Func took 1.0769367218018 microseconds<br />
Output for 5.6.16
Func took 0.94795227050781 microseconds<br />
Output for 5.6.15
Func took 1.3980865478516 microseconds<br />
Output for 5.6.14
Func took 1.2490749359131 microseconds<br />
Output for 5.6.13
Func took 0.99301338195801 microseconds<br />
Output for 5.6.12
Func took 1.0449886322021 microseconds<br />
Output for 5.6.11
Func took 1.2850761413574 microseconds<br />
Output for 5.6.10
Func took 1.288890838623 microseconds<br />
Output for 5.6.9
Func took 1.0519027709961 microseconds<br />
Output for 5.6.8
Func took 1.3480186462402 microseconds<br />
Output for 5.6.7
Func took 0.93197822570801 microseconds<br />
Output for 5.5.35
Func took 1.5299320220947 microseconds<br />
Output for 5.5.34
Func took 1.3599395751953 microseconds<br />
Output for 5.5.33
Func took 1.42502784729 microseconds<br />
Output for 5.5.32
Func took 1.115083694458 microseconds<br />
Output for 5.5.31
Func took 1.370906829834 microseconds<br />
Output for 5.3.21, 5.5.30
Func took 1.5020370483398 microseconds<br />
Output for 5.5.29
Func took 1.2869834899902 microseconds<br />
Output for 5.5.28
Func took 1.3718605041504 microseconds<br />
Output for 5.5.27
Func took 0.9610652923584 microseconds<br />
Output for 5.5.26
Func took 1.4560222625732 microseconds<br />
Output for 5.5.25
Func took 1.3260841369629 microseconds<br />
Output for 5.5.24
Func took 1.2919902801514 microseconds<br />
Output for 5.4.45
Func took 1.4371871948242 microseconds<br />
Output for 5.4.44
Func took 1.3220310211182 microseconds<br />
Output for 5.4.43
Func took 1.0929107666016 microseconds<br />
Output for 5.4.42
Func took 1.4841556549072 microseconds<br />
Output for 5.4.41
Func took 1.2569427490234 microseconds<br />
Output for 5.4.40
Func took 1.6219615936279 microseconds<br />
Output for 5.4.39
Func took 1.5079975128174 microseconds<br />
Output for 5.3.4, 5.4.38
Func took 1.6710758209229 microseconds<br />
Output for 5.4.37
Func took 1.3079643249512 microseconds<br />
Output for 5.4.36
Func took 1.6641616821289 microseconds<br />
Output for 5.4.35
Func took 1.5549659729004 microseconds<br />
Output for 5.4.34
Func took 1.3101100921631 microseconds<br />
Output for 5.4.32
Func took 1.2509822845459 microseconds<br />
Output for 5.4.31
Func took 1.4579296112061 microseconds<br />
Output for 5.4.30
Func took 1.7158985137939 microseconds<br />
Output for 5.4.12, 5.4.29
Func took 1.5530586242676 microseconds<br />
Output for 5.3.26, 5.4.28
Func took 1.5280246734619 microseconds<br />
Output for 5.4.27
Func took 1.190185546875 microseconds<br />
Output for 5.4.26
Func took 1.0058879852295 microseconds<br />
Output for 5.4.1, 5.4.25
Func took 1.5161037445068 microseconds<br />
Output for 5.4.24
Func took 1.2390613555908 microseconds<br />
Output for 5.4.23
Func took 1.5869140625 microseconds<br />
Output for 5.4.22
Func took 1.4209747314453 microseconds<br />
Output for 5.4.21
Func took 1.5599727630615 microseconds<br />
Output for 5.4.20
Func took 1.507043838501 microseconds<br />
Output for 5.4.19
Func took 1.5380382537842 microseconds<br />
Output for 5.4.18
Func took 1.2719631195068 microseconds<br />
Output for 5.4.17
Func took 1.0430812835693 microseconds<br />
Output for 5.4.16
Func took 1.3489723205566 microseconds<br />
Output for 5.3.9, 5.4.7, 5.4.15
Func took 1.5389919281006 microseconds<br />
Output for 5.4.14
Func took 1.2400150299072 microseconds<br />
Output for 5.4.2, 5.4.13
Func took 1.5439987182617 microseconds<br />
Output for 5.4.10
Func took 1.4889240264893 microseconds<br />
Output for 5.4.9
Func took 1.3999938964844 microseconds<br />
Output for 5.4.8
Func took 1.5270709991455 microseconds<br />
Output for 5.4.6
Func took 1.2819766998291 microseconds<br />
Output for 5.4.5
Func took 1.439094543457 microseconds<br />
Output for 5.4.4
Func took 1.5811920166016 microseconds<br />
Output for 5.4.3
Func took 1.5008449554443 microseconds<br />
Output for 5.4.0
Func took 1.5788078308105 microseconds<br />
Output for 5.3.29
Func took 1.4979839324951 microseconds<br />
Output for 5.3.28
Func took 1.1951923370361 microseconds<br />
Output for 5.3.27
Func took 1.2211799621582 microseconds<br />
Output for 5.3.25
Func took 1.5420913696289 microseconds<br />
Output for 5.3.24
Func took 1.30295753479 microseconds<br />
Output for 5.3.23
Func took 1.5339851379395 microseconds<br />
Output for 5.3.22
Func took 1.4629364013672 microseconds<br />
Output for 5.3.20
Func took 1.6281604766846 microseconds<br />
Output for 5.3.19
Func took 1.5199184417725 microseconds<br />
Output for 5.3.18
Func took 1.1310577392578 microseconds<br />
Output for 5.3.17
Func took 1.521110534668 microseconds<br />
Output for 5.3.16
Func took 1.5978813171387 microseconds<br />
Output for 5.3.15
Func took 1.3411045074463 microseconds<br />
Output for 5.3.14
Func took 1.5890598297119 microseconds<br />
Output for 5.3.13
Func took 1.5769004821777 microseconds<br />
Output for 5.3.12
Func took 1.0650157928467 microseconds<br />
Output for 5.3.11
Func took 1.5509128570557 microseconds<br />
Output for 5.3.10
Func took 1.4801025390625 microseconds<br />
Output for 5.3.8
Func took 1.6388893127441 microseconds<br />
Output for 5.3.7
Func took 1.6469955444336 microseconds<br />
Output for 5.3.6
Func took 1.5740394592285 microseconds<br />
Output for 5.3.5
Func took 1.5499591827393 microseconds<br />
Output for 5.3.3
Func took 1.4700889587402 microseconds<br />
Output for 5.3.2
Func took 1.4731884002686 microseconds<br />
Output for 5.3.1
Func took 1.2838840484619 microseconds<br />
Output for 5.3.0
Func took 1.1210441589355 microseconds<br />
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/obodC on line 21
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/obodC on line 14
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_CLASS in /in/obodC on line 13
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_CLASS in /in/obodC on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/obodC on line 13
Process exited with code 255.