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.68402290344238 microseconds<br />
Output for 7.0.14
Func took 0.71096420288086 microseconds<br />
Output for 7.0.6
Func took 5.0308704376221 microseconds<br />
Output for 7.0.5
Func took 0.57220458984375 microseconds<br />
Output for 7.0.4
Func took 0.78201293945312 microseconds<br />
Output for 7.0.3
Func took 0.9610652923584 microseconds<br />
Output for 7.0.2
Func took 0.69785118103027 microseconds<br />
Output for 7.0.1
Func took 0.61798095703125 microseconds<br />
Output for 7.0.0
Func took 0.90193748474121 microseconds<br />
Output for hhvm-3.12.0
Func took 0.68211555480957 microseconds<br />
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.28
Func took -2.7830600738525 microseconds<br />
Output for 5.6.21
Func took 2.6512145996094 microseconds<br />
Output for 5.6.20
Func took 2.9001235961914 microseconds<br />
Output for 5.6.19
Func took 2.9230117797852 microseconds<br />
Output for 5.6.18
Func took 1.7318725585938 microseconds<br />
Output for 5.6.17
Func took 2.4211406707764 microseconds<br />
Output for 5.6.16
Func took 1.8620491027832 microseconds<br />
Output for 5.6.15
Func took 2.8200149536133 microseconds<br />
Output for 5.6.14
Func took 2.3739337921143 microseconds<br />
Output for 5.6.13
Func took 1.6920566558838 microseconds<br />
Output for 5.6.12
Func took 2.7241706848145 microseconds<br />
Output for 5.6.11
Func took 2.8312206268311 microseconds<br />
Output for 5.6.10
Func took 2.8691291809082 microseconds<br />
Output for 5.6.9
Func took 2.9258728027344 microseconds<br />
Output for 5.6.8
Func took 2.7971267700195 microseconds<br />
Output for 5.5.35
Func took 1.7409324645996 microseconds<br />
Output for 5.5.34
Func took 2.1400451660156 microseconds<br />
Output for 5.5.33
Func took 2.1481513977051 microseconds<br />
Output for 5.5.32
Func took 3.19504737854 microseconds<br />
Output for 5.5.31
Func took 1.7049312591553 microseconds<br />
Output for 5.5.30
Func took 2.7799606323242 microseconds<br />
Output for 5.5.29
Func took 2.8221607208252 microseconds<br />
Output for 5.5.28
Func took 1.7077922821045 microseconds<br />
Output for 5.5.27
Func took 2.0749568939209 microseconds<br />
Output for 5.5.26
Func took 2.0339488983154 microseconds<br />
Output for 5.5.25
Func took 2.953052520752 microseconds<br />
Output for 5.5.24
Func took 2.979040145874 microseconds<br />
Output for 5.4.45
Func took 2.8879642486572 microseconds<br />
Output for 5.4.44
Func took 2.7928352355957 microseconds<br />
Output for 5.4.43
Func took 1.9309520721436 microseconds<br />
Output for 5.4.42
Func took 2.1600723266602 microseconds<br />
Output for 5.4.41
Func took 2.2881031036377 microseconds<br />
Output for 5.4.40
Func took 2.7749538421631 microseconds<br />
Output for 5.4.39
Func took 2.7520656585693 microseconds<br />
Output for 5.4.38
Func took 2.0160675048828 microseconds<br />
Output for 5.4.37
Func took 2.8460025787354 microseconds<br />
Output for 5.4.36
Func took 2.0909309387207 microseconds<br />
Output for 5.4.35
Func took 2.2189617156982 microseconds<br />
Output for 5.4.34
Func took 3.0009746551514 microseconds<br />
Output for 5.4.32
Func took 2.4209022521973 microseconds<br />
Output for 5.4.31
Func took 2.2299289703369 microseconds<br />
Output for 5.4.30
Func took 2.830982208252 microseconds<br />
Output for 5.4.29
Func took 1.9581317901611 microseconds<br />
Output for 5.4.28
Func took 2.9680728912354 microseconds<br />
Output for 5.4.27
Func took 3.1230449676514 microseconds<br />
Output for 5.4.26
Func took 3.0360221862793 microseconds<br />
Output for 5.4.25
Func took 2.9478073120117 microseconds<br />
Output for 5.4.24
Func took 1.8751621246338 microseconds<br />
Output for 5.4.23
Func took 2.8181076049805 microseconds<br />
Output for 5.4.22
Func took 3.2970905303955 microseconds<br />
Output for 5.4.21
Func took 2.4890899658203 microseconds<br />
Output for 5.4.20
Func took 1.9829273223877 microseconds<br />
Output for 5.3.8, 5.4.19
Func took 2.0139217376709 microseconds<br />
Output for 5.4.18
Func took 2.6960372924805 microseconds<br />
Output for 5.4.17
Func took 2.6748180389404 microseconds<br />
Output for 5.4.16
Func took 2.5608539581299 microseconds<br />
Output for 5.4.15
Func took 2.5620460510254 microseconds<br />
Output for 5.4.14
Func took 2.094030380249 microseconds<br />
Output for 5.4.13
Func took 2.6390552520752 microseconds<br />
Output for 5.4.12
Func took 2.9370784759521 microseconds<br />
Output for 5.4.11
Func took 2.7248859405518 microseconds<br />
Output for 5.4.10
Func took 2.3529529571533 microseconds<br />
Output for 5.4.9
Func took 1.9729137420654 microseconds<br />
Output for 5.4.8
Func took 2.1240711212158 microseconds<br />
Output for 5.4.7
Func took 3.0379295349121 microseconds<br />
Output for 5.4.6
Func took 3.000020980835 microseconds<br />
Output for 5.4.5
Func took 2.3550987243652 microseconds<br />
Output for 5.4.4
Func took 2.8080940246582 microseconds<br />
Output for 5.4.3
Func took 2.9850006103516 microseconds<br />
Output for 5.4.2
Func took 2.1359920501709 microseconds<br />
Output for 5.4.1
Func took 2.8719902038574 microseconds<br />
Output for 5.4.0
Func took 2.2068023681641 microseconds<br />
Output for 5.3.29
Func took 2.6290416717529 microseconds<br />
Output for 5.3.28
Func took 2.2680759429932 microseconds<br />
Output for 5.3.27
Func took 2.0289421081543 microseconds<br />
Output for 5.3.26
Func took 1.9330978393555 microseconds<br />
Output for 5.3.25
Func took 1.8999576568604 microseconds<br />
Output for 5.3.24
Func took 1.9569396972656 microseconds<br />
Output for 5.3.23
Func took 2.3288726806641 microseconds<br />
Output for 5.3.22
Func took 1.9700527191162 microseconds<br />
Output for 5.3.21
Func took 3.0238628387451 microseconds<br />
Output for 5.3.20
Func took 2.4361610412598 microseconds<br />
Output for 5.3.19
Func took 1.9910335540771 microseconds<br />
Output for 5.3.18
Func took 1.8730163574219 microseconds<br />
Output for 5.3.17
Func took 2.3519992828369 microseconds<br />
Output for 5.3.16
Func took 2.1390914916992 microseconds<br />
Output for 5.3.15
Func took 1.8658638000488 microseconds<br />
Output for 5.3.14
Func took 1.8911361694336 microseconds<br />
Output for 5.3.13
Func took 2.1278858184814 microseconds<br />
Output for 5.3.12
Func took 1.9538402557373 microseconds<br />
Output for 5.3.11
Func took 2.8300285339355 microseconds<br />
Output for 5.3.10
Func took 1.9149780273438 microseconds<br />
Output for 5.3.9
Func took 1.8539428710938 microseconds<br />
Output for 5.3.7
Func took 2.0899772644043 microseconds<br />
Output for 5.3.6
Func took 2.1841526031494 microseconds<br />
Output for 5.3.5
Func took 2.6531219482422 microseconds<br />
Output for 5.3.4
Func took 2.1049976348877 microseconds<br />
Output for 5.3.3
Func took 2.0389556884766 microseconds<br />
Output for 5.3.2
Func took 3.1759738922119 microseconds<br />
Output for 5.3.1
Func took 2.4220943450928 microseconds<br />
Output for 5.3.0
Func took 2.161979675293 microseconds<br />
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/mTvKJ 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/mTvKJ 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/mTvKJ 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/mTvKJ on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/mTvKJ on line 13
Process exited with code 255.