3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $classmap1 = array(); for ($i=1; $i<=50000; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=50000; $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 4.9021244049072 microseconds<br />
Output for 7.0.14
Func took 5.3479671478271 microseconds<br />
Output for 7.0.6
Func took 5.5420398712158 microseconds<br />
Output for 7.0.5
Func took 4.3261051177979 microseconds<br />
Output for 7.0.4
Func took 5.7098865509033 microseconds<br />
Output for 7.0.3
Func took 5.1848888397217 microseconds<br />
Output for 7.0.2
Func took 4.3599605560303 microseconds<br />
Output for 7.0.1
Func took 4.0240287780762 microseconds<br />
Output for 7.0.0
Func took 5.3439140319824 microseconds<br />
Output for hhvm-3.12.0
Func took 21.905899047852 microseconds<br />
Output for hhvm-3.10.0
Func took 23.102998733521 microseconds<br />
Output for 5.6.28
Func took 28.128147125244 microseconds<br />
Output for 5.6.21
Func took 25.689125061035 microseconds<br />
Output for 5.6.20
Func took 28.011083602905 microseconds<br />
Output for 5.6.19
Func took 29.129981994629 microseconds<br />
Output for 5.6.18
Func took 29.475927352905 microseconds<br />
Output for 5.6.17
Func took 27.251958847046 microseconds<br />
Output for 5.6.16
Func took 28.158903121948 microseconds<br />
Output for 5.6.15
Func took 27.703046798706 microseconds<br />
Output for 5.6.14
Func took 26.529788970947 microseconds<br />
Output for 5.6.13
Func took 25.989055633545 microseconds<br />
Output for 5.6.12
Func took 27.708053588867 microseconds<br />
Output for 5.6.11
Func took 28.664827346802 microseconds<br />
Output for 5.6.10
Func took 26.18408203125 microseconds<br />
Output for 5.6.9
Func took 25.808095932007 microseconds<br />
Output for 5.6.8
Func took 22.413969039917 microseconds<br />
Output for 5.6.7
Func took 29.049873352051 microseconds<br />
Output for 5.6.6
Func took 26.473999023438 microseconds<br />
Output for 5.6.5
Func took 28.975009918213 microseconds<br />
Output for 5.6.4
Func took 27.29606628418 microseconds<br />
Output for 5.6.3
Func took 28.033971786499 microseconds<br />
Output for 5.6.2
Func took 24.95002746582 microseconds<br />
Output for 5.6.1
Func took 28.053998947144 microseconds<br />
Output for 5.6.0
Func took 28.659820556641 microseconds<br />
Output for 5.5.35
Func took 27.343034744263 microseconds<br />
Output for 5.5.34
Func took 24.028062820435 microseconds<br />
Output for 5.5.33
Func took 27.857065200806 microseconds<br />
Output for 5.5.32
Func took 23.32592010498 microseconds<br />
Output for 5.5.31
Func took 24.808883666992 microseconds<br />
Output for 5.5.30
Func took 29.695987701416 microseconds<br />
Output for 5.5.29
Func took 27.450084686279 microseconds<br />
Output for 5.5.28
Func took 32.467842102051 microseconds<br />
Output for 5.5.27
Func took 27.390003204346 microseconds<br />
Output for 5.5.26
Func took 28.244018554688 microseconds<br />
Output for 5.5.25
Func took 25.604009628296 microseconds<br />
Output for 5.5.24
Func took 25.647878646851 microseconds<br />
Output for 5.5.23
Func took 26.647090911865 microseconds<br />
Output for 5.5.22
Func took 28.693914413452 microseconds<br />
Output for 5.5.21
Func took 27.781963348389 microseconds<br />
Output for 5.5.20
Func took 28.239965438843 microseconds<br />
Output for 5.5.19
Func took 28.350114822388 microseconds<br />
Output for 5.5.18
Func took 29.213905334473 microseconds<br />
Output for 5.5.16
Func took 27.731895446777 microseconds<br />
Output for 5.5.15
Func took 23.205995559692 microseconds<br />
Output for 5.5.14
Func took 27.765989303589 microseconds<br />
Output for 5.5.13
Func took 27.673959732056 microseconds<br />
Output for 5.5.12
Func took 23.449897766113 microseconds<br />
Output for 5.5.11
Func took 26.417970657349 microseconds<br />
Output for 5.5.10
Func took 29.515027999878 microseconds<br />
Output for 5.5.9
Func took 28.034925460815 microseconds<br />
Output for 5.5.8
Func took 28.686046600342 microseconds<br />
Output for 5.5.7
Func took 25.965929031372 microseconds<br />
Output for 5.5.6
Func took 28.621912002563 microseconds<br />
Output for 5.5.5
Func took 25.084972381592 microseconds<br />
Output for 5.5.4
Func took 33.931016921997 microseconds<br />
Output for 5.5.3
Func took 29.453039169312 microseconds<br />
Output for 5.5.2
Func took 22.816896438599 microseconds<br />
Output for 5.5.1
Func took 26.849031448364 microseconds<br />
Output for 5.5.0
Func took 29.062032699585 microseconds<br />
Output for 5.4.45
Func took 27.858972549438 microseconds<br />
Output for 5.4.44
Func took 31.561851501465 microseconds<br />
Output for 5.4.43
Func took 32.709121704102 microseconds<br />
Output for 5.4.42
Func took 31.430959701538 microseconds<br />
Output for 5.4.41
Func took 27.467966079712 microseconds<br />
Output for 5.4.40
Func took 27.362108230591 microseconds<br />
Output for 5.4.39
Func took 30.154943466187 microseconds<br />
Output for 5.4.38
Func took 27.501106262207 microseconds<br />
Output for 5.4.37
Func took 29.394865036011 microseconds<br />
Output for 5.4.36
Func took 27.04906463623 microseconds<br />
Output for 5.4.35
Func took 31.195878982544 microseconds<br />
Output for 5.4.34
Func took 30.317068099976 microseconds<br />
Output for 5.4.32
Func took 24.85990524292 microseconds<br />
Output for 5.4.31
Func took 30.946016311646 microseconds<br />
Output for 5.4.30
Func took 26.081085205078 microseconds<br />
Output for 5.4.29
Func took 29.942035675049 microseconds<br />
Output for 5.4.28
Func took 29.20389175415 microseconds<br />
Output for 5.4.27
Func took 28.394937515259 microseconds<br />
Output for 5.4.26
Func took 30.529975891113 microseconds<br />
Output for 5.4.25
Func took 28.541803359985 microseconds<br />
Output for 5.4.24
Func took 30.575037002563 microseconds<br />
Output for 5.4.23
Func took 24.620056152344 microseconds<br />
Output for 5.4.22
Func took 29.675960540771 microseconds<br />
Output for 5.4.21
Func took 30.415058135986 microseconds<br />
Output for 5.4.20
Func took 28.508901596069 microseconds<br />
Output for 5.4.19
Func took 29.921054840088 microseconds<br />
Output for 5.4.18
Func took 29.363870620728 microseconds<br />
Output for 5.4.17
Func took 23.814916610718 microseconds<br />
Output for 5.4.16
Func took 30.607223510742 microseconds<br />
Output for 5.4.15
Func took 26.337862014771 microseconds<br />
Output for 5.4.14
Func took 23.452997207642 microseconds<br />
Output for 5.4.13
Func took 31.669855117798 microseconds<br />
Output for 5.4.12
Func took 27.236938476562 microseconds<br />
Output for 5.4.11
Func took 29.816150665283 microseconds<br />
Output for 5.4.10
Func took 29.562950134277 microseconds<br />
Output for 5.4.9
Func took 30.50684928894 microseconds<br />
Output for 5.4.8
Func took 30.47513961792 microseconds<br />
Output for 5.4.7
Func took 31.234979629517 microseconds<br />
Output for 5.4.6
Func took 29.850006103516 microseconds<br />
Output for 5.4.5
Func took 29.428958892822 microseconds<br />
Output for 5.4.4
Func took 28.985023498535 microseconds<br />
Output for 5.4.3
Func took 29.264211654663 microseconds<br />
Output for 5.4.2
Func took 27.426958084106 microseconds<br />
Output for 5.4.1
Func took 29.977083206177 microseconds<br />
Output for 5.4.0
Func took 25.69317817688 microseconds<br />
Output for 5.3.29
Func took 30.148983001709 microseconds<br />
Output for 5.3.28
Func took 23.231983184814 microseconds<br />
Output for 5.3.27
Func took 22.8271484375 microseconds<br />
Output for 5.3.26
Func took 29.146909713745 microseconds<br />
Output for 5.3.25
Func took 23.236036300659 microseconds<br />
Output for 5.3.24
Func took 27.354955673218 microseconds<br />
Output for 5.3.23
Func took 29.135942459106 microseconds<br />
Output for 5.3.22
Func took 29.553890228271 microseconds<br />
Output for 5.3.21
Func took 29.806852340698 microseconds<br />
Output for 5.3.20
Func took 29.551982879639 microseconds<br />
Output for 5.3.19
Func took 45.984983444214 microseconds<br />
Output for 5.3.18
Func took 28.438091278076 microseconds<br />
Output for 5.3.17
Func took 26.664972305298 microseconds<br />
Output for 5.3.16
Func took 25.399923324585 microseconds<br />
Output for 5.3.15
Func took 30.147075653076 microseconds<br />
Output for 5.3.14
Func took 29.457092285156 microseconds<br />
Output for 5.3.13
Func took 28.540134429932 microseconds<br />
Output for 5.3.12
Func took 28.19299697876 microseconds<br />
Output for 5.3.11
Func took 26.658058166504 microseconds<br />
Output for 5.3.10
Func took 24.147987365723 microseconds<br />
Output for 5.3.9
Func took 29.162883758545 microseconds<br />
Output for 5.3.8
Func took 30.409097671509 microseconds<br />
Output for 5.3.7
Func took 29.644012451172 microseconds<br />
Output for 5.3.6
Func took 30.044078826904 microseconds<br />
Output for 5.3.5
Func took 28.470039367676 microseconds<br />
Output for 5.3.4
Func took 26.942014694214 microseconds<br />
Output for 5.3.3
Func took 26.833057403564 microseconds<br />
Output for 5.3.2
Func took 31.743049621582 microseconds<br />
Output for 5.3.1
Func took 24.111986160278 microseconds<br />
Output for 5.3.0
Func took 26.131868362427 microseconds<br />
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/CjDv5 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/CjDv5 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/CjDv5 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/CjDv5 on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/CjDv5 on line 13
Process exited with code 255.