3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $classmap1 = array(); for ($i=1; $i<=1000; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=1000; $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.092983245849609 microseconds<br />
Output for 7.0.14
Func took 0.10204315185547 microseconds<br />
Output for 7.0.11
Func took 0.083208084106445 microseconds<br />
Output for 7.0.10
Func took 0.08702278137207 microseconds<br />
Output for 7.0.9
Func took 0.08392333984375 microseconds<br />
Output for 7.0.8
Func took 0.097990036010742 microseconds<br />
Output for 7.0.7
Func took 0.079870223999023 microseconds<br />
Output for 7.0.6
Func took 0.082015991210938 microseconds<br />
Output for 7.0.5
Func took 0.08082389831543 microseconds<br />
Output for 7.0.4
Func took 0.060081481933594 microseconds<br />
Output for 7.0.3
Func took 0.070095062255859 microseconds<br />
Output for 7.0.2
Func took 0.090122222900391 microseconds<br />
Output for 7.0.1
Func took 0.095844268798828 microseconds<br />
Output for 7.0.0
Func took 0.058174133300781 microseconds<br />
Output for hhvm-3.13.2
Func took 0.21100044250488 microseconds<br />
Output for hhvm-3.12.0
Func took 0.20909309387207 microseconds<br />
Output for hhvm-3.10.0
Func took 0.24580955505371 microseconds<br />
Output for 5.6.28
Func took 0.52809715270996 microseconds<br />
Output for 5.3.27, 5.4.8, 5.6.26
Func took 0.32401084899902 microseconds<br />
Output for 5.6.25
Func took 0.32687187194824 microseconds<br />
Output for 5.6.24
Func took 0.44012069702148 microseconds<br />
Output for 5.6.23
Func took 0.30899047851562 microseconds<br />
Output for 5.4.45, 5.6.22
Func took 0.2748966217041 microseconds<br />
Output for 5.6.21
Func took 0.55217742919922 microseconds<br />
Output for 5.5.31, 5.6.8, 5.6.20
Func took 0.3211498260498 microseconds<br />
Output for 5.4.41, 5.6.19
Func took 0.32496452331543 microseconds<br />
Output for 5.4.2, 5.5.33, 5.6.17 - 5.6.18
Func took 0.31900405883789 microseconds<br />
Output for 5.3.26, 5.6.16
Func took 0.3509521484375 microseconds<br />
Output for 5.6.15
Func took 0.40602684020996 microseconds<br />
Output for 5.6.14
Func took 0.44488906860352 microseconds<br />
Output for 5.6.13
Func took 0.32281875610352 microseconds<br />
Output for 5.6.12
Func took 0.32591819763184 microseconds<br />
Output for 5.6.11
Func took 0.31709671020508 microseconds<br />
Output for 5.4.39, 5.6.10
Func took 0.33688545227051 microseconds<br />
Output for 5.6.9
Func took 0.32186508178711 microseconds<br />
Output for 5.4.43, 5.6.7
Func took 0.32210350036621 microseconds<br />
Output for 5.6.6
Func took 0.3209114074707 microseconds<br />
Output for 5.5.3, 5.6.5
Func took 0.3049373626709 microseconds<br />
Output for 5.6.4
Func took 0.49710273742676 microseconds<br />
Output for 5.6.3
Func took 0.37693977355957 microseconds<br />
Output for 5.6.2
Func took 0.51784515380859 microseconds<br />
Output for 5.6.1
Func took 0.43416023254395 microseconds<br />
Output for 5.6.0
Func took 0.48303604125977 microseconds<br />
Output for 5.3.6, 5.5.38
Func took 0.33712387084961 microseconds<br />
Output for 5.5.37
Func took 0.27918815612793 microseconds<br />
Output for 5.5.36
Func took 0.38385391235352 microseconds<br />
Output for 5.3.19, 5.5.35
Func took 0.33092498779297 microseconds<br />
Output for 5.4.18, 5.5.34
Func took 0.32711029052734 microseconds<br />
Output for 5.5.32
Func took 0.34499168395996 microseconds<br />
Output for 5.5.30
Func took 0.32877922058105 microseconds<br />
Output for 5.5.29
Func took 0.2741813659668 microseconds<br />
Output for 5.4.42, 5.5.15, 5.5.28
Func took 0.32997131347656 microseconds<br />
Output for 5.5.27
Func took 0.27108192443848 microseconds<br />
Output for 5.5.26
Func took 0.3809928894043 microseconds<br />
Output for 5.5.25
Func took 0.33903121948242 microseconds<br />
Output for 5.5.24
Func took 0.52523612976074 microseconds<br />
Output for 5.5.23
Func took 0.26893615722656 microseconds<br />
Output for 5.5.8, 5.5.22
Func took 0.2739429473877 microseconds<br />
Output for 5.5.20 - 5.5.21
Func took 0.31805038452148 microseconds<br />
Output for 5.5.19
Func took 0.52213668823242 microseconds<br />
Output for 5.5.18
Func took 0.4580020904541 microseconds<br />
Output for 5.5.16
Func took 0.34999847412109 microseconds<br />
Output for 5.5.14
Func took 0.46205520629883 microseconds<br />
Output for 5.5.13
Func took 0.33402442932129 microseconds<br />
Output for 5.5.12
Func took 0.47087669372559 microseconds<br />
Output for 5.5.11
Func took 0.41794776916504 microseconds<br />
Output for 5.5.10
Func took 0.40698051452637 microseconds<br />
Output for 5.5.9
Func took 0.3199577331543 microseconds<br />
Output for 5.3.24, 5.4.16, 5.5.7
Func took 0.37002563476562 microseconds<br />
Output for 5.5.6
Func took 0.53691864013672 microseconds<br />
Output for 5.5.5
Func took 0.4889965057373 microseconds<br />
Output for 5.4.44, 5.5.4
Func took 0.35595893859863 microseconds<br />
Output for 5.4.9, 5.5.2
Func took 0.32806396484375 microseconds<br />
Output for 5.5.1
Func took 0.44918060302734 microseconds<br />
Output for 5.5.0
Func took 0.50187110900879 microseconds<br />
Output for 5.4.40
Func took 0.27990341186523 microseconds<br />
Output for 5.4.38
Func took 0.3349781036377 microseconds<br />
Output for 5.4.37
Func took 0.3359317779541 microseconds<br />
Output for 5.3.3, 5.4.3, 5.4.36
Func took 0.47492980957031 microseconds<br />
Output for 5.4.35
Func took 0.60200691223145 microseconds<br />
Output for 5.4.34
Func took 0.60105323791504 microseconds<br />
Output for 5.4.32
Func took 0.52690505981445 microseconds<br />
Output for 5.4.31
Func took 0.41317939758301 microseconds<br />
Output for 5.4.30
Func took 0.41508674621582 microseconds<br />
Output for 5.4.29
Func took 0.32520294189453 microseconds<br />
Output for 5.4.28
Func took 0.39911270141602 microseconds<br />
Output for 5.4.27
Func took 0.56314468383789 microseconds<br />
Output for 5.4.26
Func took 0.30779838562012 microseconds<br />
Output for 5.4.25
Func took 0.34379959106445 microseconds<br />
Output for 5.4.24
Func took 0.44393539428711 microseconds<br />
Output for 5.3.4, 5.4.23
Func took 0.34713745117188 microseconds<br />
Output for 5.4.22
Func took 0.54621696472168 microseconds<br />
Output for 5.4.21
Func took 0.34618377685547 microseconds<br />
Output for 5.4.20
Func took 0.42819976806641 microseconds<br />
Output for 5.4.19
Func took 0.50997734069824 microseconds<br />
Output for 5.4.17
Func took 0.4270076751709 microseconds<br />
Output for 5.4.15
Func took 0.43296813964844 microseconds<br />
Output for 5.4.14
Func took 0.53191184997559 microseconds<br />
Output for 5.4.13
Func took 0.36406517028809 microseconds<br />
Output for 5.4.12
Func took 0.5030632019043 microseconds<br />
Output for 5.4.11
Func took 0.37717819213867 microseconds<br />
Output for 5.4.10
Func took 0.39196014404297 microseconds<br />
Output for 5.4.7
Func took 0.39505958557129 microseconds<br />
Output for 5.4.6
Func took 0.48494338989258 microseconds<br />
Output for 5.4.5
Func took 0.38409233093262 microseconds<br />
Output for 5.4.4
Func took 0.37908554077148 microseconds<br />
Output for 5.3.5, 5.4.1
Func took 0.51307678222656 microseconds<br />
Output for 5.4.0
Func took 0.36287307739258 microseconds<br />
Output for 5.3.29
Func took 0.51498413085938 microseconds<br />
Output for 5.3.28
Func took 0.53811073303223 microseconds<br />
Output for 5.3.25
Func took 0.49686431884766 microseconds<br />
Output for 5.3.23
Func took 0.34284591674805 microseconds<br />
Output for 5.3.22
Func took 0.60701370239258 microseconds<br />
Output for 5.3.21
Func took 0.34403800964355 microseconds<br />
Output for 5.3.20
Func took 0.51212310791016 microseconds<br />
Output for 5.3.17 - 5.3.18
Func took 0.33307075500488 microseconds<br />
Output for 5.3.16
Func took 0.49591064453125 microseconds<br />
Output for 5.3.15
Func took 0.37384033203125 microseconds<br />
Output for 5.3.14
Func took 0.49495697021484 microseconds<br />
Output for 5.3.13
Func took 0.33116340637207 microseconds<br />
Output for 5.3.12
Func took 0.57196617126465 microseconds<br />
Output for 5.3.0, 5.3.11
Func took 0.49090385437012 microseconds<br />
Output for 5.3.10
Func took 0.4880428314209 microseconds<br />
Output for 5.3.9
Func took 0.33998489379883 microseconds<br />
Output for 5.3.8
Func took 0.32615661621094 microseconds<br />
Output for 5.3.7
Func took 0.34594535827637 microseconds<br />
Output for 5.3.2
Func took 0.46896934509277 microseconds<br />
Output for 5.3.1
Func took 0.43487548828125 microseconds<br />
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/0J4Pv 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/0J4Pv 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/0J4Pv 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/0J4Pv on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/0J4Pv on line 13
Process exited with code 255.