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]) || array_key_exists($key, $a)) { 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.92601776123047 microseconds<br />
Output for 7.0.14
Func took 1.1789798736572 microseconds<br />
Output for 7.0.10
Func took 19.762992858887 microseconds<br />
Output for 7.0.9
Func took 16.67308807373 microseconds<br />
Output for 7.0.8
Func took 9.6709728240967 microseconds<br />
Output for 7.0.7
Func took 8.1589221954346 microseconds<br />
Output for 7.0.6
Func took 11.846780776978 microseconds<br />
Output for 7.0.5
Func took 14.245986938477 microseconds<br />
Output for 7.0.4
Func took 0.53501129150391 microseconds<br />
Output for 7.0.3
Func took 0.97894668579102 microseconds<br />
Output for 7.0.2
Func took 1.1618137359619 microseconds<br />
Output for 7.0.1
Func took 0.97799301147461 microseconds<br />
Output for 7.0.0
Func took 0.9000301361084 microseconds<br />
Output for hhvm-3.12.0
Func took 1.276969909668 microseconds<br />
Output for hhvm-3.10.0
Func took 1.6970634460449 microseconds<br />
Output for 5.6.28
Func took 2.9881000518799 microseconds<br />
Output for 5.6.25
Func took 2.6659965515137 microseconds<br />
Output for 5.6.24
Func took 1.8129348754883 microseconds<br />
Output for 5.6.23
Func took 1.816987991333 microseconds<br />
Output for 5.6.22
Func took 2.6698112487793 microseconds<br />
Output for 5.6.21
Func took 2.2990703582764 microseconds<br />
Output for 5.6.20
Func took 1.9209384918213 microseconds<br />
Output for 5.6.19
Func took 2.3620128631592 microseconds<br />
Output for 5.6.18
Func took 4.3401718139648 microseconds<br />
Output for 5.6.17
Func took 2.2821426391602 microseconds<br />
Output for 5.6.16
Func took 2.6671886444092 microseconds<br />
Output for 5.3.25, 5.6.15
Func took 2.6600360870361 microseconds<br />
Output for 5.6.14
Func took 2.5260448455811 microseconds<br />
Output for 5.6.13
Func took 2.9568672180176 microseconds<br />
Output for 5.6.12
Func took 2.5501251220703 microseconds<br />
Output for 5.6.11
Func took 2.3438930511475 microseconds<br />
Output for 5.6.10
Func took 2.532958984375 microseconds<br />
Output for 5.4.15, 5.6.9
Func took 3.1189918518066 microseconds<br />
Output for 5.4.28, 5.6.8
Func took 2.5820732116699 microseconds<br />
Output for 5.6.7
Func took 3.0968189239502 microseconds<br />
Output for 5.6.6
Func took 3.1180381774902 microseconds<br />
Output for 5.6.5
Func took 2.5629997253418 microseconds<br />
Output for 5.6.4
Func took 2.2969245910645 microseconds<br />
Output for 5.6.3
Func took 3.1650066375732 microseconds<br />
Output for 5.6.2
Func took 3.1230449676514 microseconds<br />
Output for 5.6.1
Func took 2.2809505462646 microseconds<br />
Output for 5.6.0
Func took 2.8390884399414 microseconds<br />
Output for 5.5.38
Func took 2.3109912872314 microseconds<br />
Output for 5.5.37
Func took 2.1848678588867 microseconds<br />
Output for 5.5.36
Func took 1.8889904022217 microseconds<br />
Output for 5.5.35
Func took 2.0289421081543 microseconds<br />
Output for 5.5.34
Func took 1.9168853759766 microseconds<br />
Output for 5.5.33
Func took 1.8980503082275 microseconds<br />
Output for 5.5.32
Func took 4.4119358062744 microseconds<br />
Output for 5.5.31
Func took 2.9268264770508 microseconds<br />
Output for 5.5.30
Func took 3.5049915313721 microseconds<br />
Output for 5.5.29
Func took 2.6040077209473 microseconds<br />
Output for 5.5.28
Func took 2.7549266815186 microseconds<br />
Output for 5.5.27
Func took 2.5539398193359 microseconds<br />
Output for 5.5.26
Func took 2.5689601898193 microseconds<br />
Output for 5.5.25
Func took 3.01194190979 microseconds<br />
Output for 5.5.24
Func took 2.9401779174805 microseconds<br />
Output for 5.5.23
Func took 2.9821395874023 microseconds<br />
Output for 5.5.22
Func took 2.8409957885742 microseconds<br />
Output for 5.5.21
Func took 2.7968883514404 microseconds<br />
Output for 5.5.20
Func took 3.0958652496338 microseconds<br />
Output for 5.5.19
Func took 3.2289028167725 microseconds<br />
Output for 5.5.18
Func took 3.2320022583008 microseconds<br />
Output for 5.5.16
Func took 3.220796585083 microseconds<br />
Output for 5.5.15
Func took 4.4841766357422 microseconds<br />
Output for 5.5.14
Func took 3.2379627227783 microseconds<br />
Output for 5.5.13
Func took 2.9590129852295 microseconds<br />
Output for 5.5.12
Func took 2.1519660949707 microseconds<br />
Output for 5.5.11
Func took 3.101110458374 microseconds<br />
Output for 5.5.10
Func took 2.5889873504639 microseconds<br />
Output for 5.5.9
Func took 2.5808811187744 microseconds<br />
Output for 5.5.8
Func took 2.8910636901855 microseconds<br />
Output for 5.5.7
Func took 2.2299289703369 microseconds<br />
Output for 5.4.37, 5.5.6
Func took 2.7689933776855 microseconds<br />
Output for 5.5.5
Func took 2.5489330291748 microseconds<br />
Output for 5.5.4
Func took 4.8351287841797 microseconds<br />
Output for 5.5.3
Func took 2.964973449707 microseconds<br />
Output for 5.5.2
Func took 3.1960010528564 microseconds<br />
Output for 5.5.1
Func took 2.1088123321533 microseconds<br />
Output for 5.5.0
Func took 3.4079551696777 microseconds<br />
Output for 5.4.45
Func took 3.1299591064453 microseconds<br />
Output for 5.4.44
Func took 3.1311511993408 microseconds<br />
Output for 5.4.43
Func took 2.7410984039307 microseconds<br />
Output for 5.4.42
Func took 3.0121803283691 microseconds<br />
Output for 5.4.41
Func took 3.2920837402344 microseconds<br />
Output for 5.4.40
Func took 3.0970573425293 microseconds<br />
Output for 5.4.39
Func took 3.2010078430176 microseconds<br />
Output for 5.4.38
Func took 3.054141998291 microseconds<br />
Output for 5.4.36
Func took 3.1108856201172 microseconds<br />
Output for 5.4.35
Func took 2.3460388183594 microseconds<br />
Output for 5.4.34
Func took 3.1321048736572 microseconds<br />
Output for 5.4.32
Func took 3.1099319458008 microseconds<br />
Output for 5.4.31
Func took 3.1421184539795 microseconds<br />
Output for 5.4.30
Func took 3.093957901001 microseconds<br />
Output for 5.4.29
Func took 3.2458305358887 microseconds<br />
Output for 5.4.27
Func took 3.1449794769287 microseconds<br />
Output for 5.4.26
Func took 2.9690265655518 microseconds<br />
Output for 5.4.25
Func took 3.07297706604 microseconds<br />
Output for 5.4.24
Func took 3.2501220703125 microseconds<br />
Output for 5.4.23
Func took 3.2930374145508 microseconds<br />
Output for 5.4.22
Func took 3.0479431152344 microseconds<br />
Output for 5.4.21
Func took 2.8278827667236 microseconds<br />
Output for 5.4.20
Func took 2.6359558105469 microseconds<br />
Output for 5.4.19
Func took 2.9559135437012 microseconds<br />
Output for 5.4.18
Func took 3.1390190124512 microseconds<br />
Output for 5.4.17
Func took 2.7501583099365 microseconds<br />
Output for 5.3.10, 5.4.16
Func took 3.2339096069336 microseconds<br />
Output for 5.4.14
Func took 2.7370452880859 microseconds<br />
Output for 5.4.13
Func took 3.1270980834961 microseconds<br />
Output for 5.4.12
Func took 2.8600692749023 microseconds<br />
Output for 5.4.11
Func took 2.3229122161865 microseconds<br />
Output for 5.4.10
Func took 2.9580593109131 microseconds<br />
Output for 5.4.9
Func took 2.8331279754639 microseconds<br />
Output for 5.4.8
Func took 3.6718845367432 microseconds<br />
Output for 5.4.7
Func took 3.1921863555908 microseconds<br />
Output for 5.4.6
Func took 2.842903137207 microseconds<br />
Output for 5.4.5
Func took 3.0949115753174 microseconds<br />
Output for 5.4.4
Func took 2.9311180114746 microseconds<br />
Output for 5.4.3
Func took 3.2191276550293 microseconds<br />
Output for 5.4.2
Func took 3.1700134277344 microseconds<br />
Output for 5.4.1
Func took 2.5460720062256 microseconds<br />
Output for 5.4.0
Func took 2.6230812072754 microseconds<br />
Output for 5.3.29
Func took 3.0038356781006 microseconds<br />
Output for 5.3.28
Func took 2.5970935821533 microseconds<br />
Output for 5.3.27
Func took 3.2529830932617 microseconds<br />
Output for 5.3.26
Func took 2.4969577789307 microseconds<br />
Output for 5.3.24
Func took 3.3690929412842 microseconds<br />
Output for 5.3.23
Func took 2.9668807983398 microseconds<br />
Output for 5.3.22
Func took 3.2970905303955 microseconds<br />
Output for 5.3.21
Func took 2.1669864654541 microseconds<br />
Output for 5.3.20
Func took 3.3810138702393 microseconds<br />
Output for 5.3.19
Func took 2.8560161590576 microseconds<br />
Output for 5.3.18
Func took 3.7651062011719 microseconds<br />
Output for 5.3.17
Func took 3.0770301818848 microseconds<br />
Output for 5.3.16
Func took 3.3969879150391 microseconds<br />
Output for 5.3.15
Func took 3.3378601074219 microseconds<br />
Output for 5.3.14
Func took 3.389835357666 microseconds<br />
Output for 5.3.13
Func took 3.0550956726074 microseconds<br />
Output for 5.3.12
Func took 3.0298233032227 microseconds<br />
Output for 5.3.11
Func took 3.3831596374512 microseconds<br />
Output for 5.3.9
Func took 3.342866897583 microseconds<br />
Output for 5.3.8
Func took 3.0879974365234 microseconds<br />
Output for 5.3.7
Func took 3.1719207763672 microseconds<br />
Output for 5.3.6
Func took 3.2238960266113 microseconds<br />
Output for 5.3.5
Func took 2.8760433197021 microseconds<br />
Output for 5.3.4
Func took 3.4081935882568 microseconds<br />
Output for 5.3.3
Func took 2.7620792388916 microseconds<br />
Output for 5.3.2
Func took 3.3879280090332 microseconds<br />
Output for 5.3.1
Func took 2.7101039886475 microseconds<br />
Output for 5.3.0
Func took 2.6731491088867 microseconds<br />
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/pglkZ 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/pglkZ 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/pglkZ 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/pglkZ on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/pglkZ on line 13
Process exited with code 255.