3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=10000; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=10000; $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.7
Func took 0.73909759521484 microseconds<br />
Output for 7.1.6
Func took 1.7869472503662 microseconds<br />
Output for 7.1.5
Func took 1.568078994751 microseconds<br />
Output for 7.1.0
Func took 1.7099380493164 microseconds<br />
Output for 7.0.20
Func took 471.01092338562 microseconds<br />
Output for 7.0.14
Func took 1.166820526123 microseconds<br />
Output for 7.0.7
Func took 2.2881031036377 microseconds<br />
Output for 7.0.6
Func took 2.2780895233154 microseconds<br />
Output for 7.0.5
Func took 2.1791458129883 microseconds<br />
Output for 7.0.4
Func took 0.81300735473633 microseconds<br />
Output for 7.0.3
Func took 0.82707405090332 microseconds<br />
Output for 7.0.2
Func took 0.94699859619141 microseconds<br />
Output for 7.0.1
Func took 0.65708160400391 microseconds<br />
Output for 7.0.0
Func took 0.7319450378418 microseconds<br />
Output for 5.6.28
Func took 5.7170391082764 microseconds<br />
Output for 5.6.22
Func took 3.6489963531494 microseconds<br />
Output for 5.6.21
Func took 3.6358833312988 microseconds<br />
Output for 5.5.11, 5.6.20
Func took 4.3990612030029 microseconds<br />
Output for 5.6.19
Func took 4.6370029449463 microseconds<br />
Output for 5.6.18
Func took 3.7579536437988 microseconds<br />
Output for 5.6.17
Func took 4.3420791625977 microseconds<br />
Output for 5.6.16
Func took 2.9230117797852 microseconds<br />
Output for 5.6.15
Func took 3.4451484680176 microseconds<br />
Output for 5.6.14
Func took 3.4949779510498 microseconds<br />
Output for 5.6.13
Func took 5.0220489501953 microseconds<br />
Output for 5.6.12
Func took 3.1681060791016 microseconds<br />
Output for 5.6.11
Func took 3.4680366516113 microseconds<br />
Output for 5.6.10
Func took 3.4458637237549 microseconds<br />
Output for 5.6.9
Func took 3.0138492584229 microseconds<br />
Output for 5.6.8
Func took 3.4990310668945 microseconds<br />
Output for 5.3.29, 5.6.7
Func took 6.0169696807861 microseconds<br />
Output for 5.6.6
Func took 5.2490234375 microseconds<br />
Output for 5.6.5
Func took 5.0961971282959 microseconds<br />
Output for 5.6.4
Func took 5.9731006622314 microseconds<br />
Output for 5.6.3
Func took 6.5689086914062 microseconds<br />
Output for 5.6.2
Func took 4.9760341644287 microseconds<br />
Output for 5.3.21, 5.6.1
Func took 5.2909851074219 microseconds<br />
Output for 5.6.0
Func took 5.856990814209 microseconds<br />
Output for 5.5.25, 5.5.36
Func took 3.7190914154053 microseconds<br />
Output for 5.5.35
Func took 3.8919448852539 microseconds<br />
Output for 5.5.34
Func took 3.6799907684326 microseconds<br />
Output for 5.5.33
Func took 3.7400722503662 microseconds<br />
Output for 5.5.32
Func took 3.4627914428711 microseconds<br />
Output for 5.5.31
Func took 3.5769939422607 microseconds<br />
Output for 5.5.30
Func took 3.5290718078613 microseconds<br />
Output for 5.5.29
Func took 3.6070346832275 microseconds<br />
Output for 5.5.28
Func took 3.4890174865723 microseconds<br />
Output for 5.5.27
Func took 3.5459995269775 microseconds<br />
Output for 5.5.26
Func took 4.1148662567139 microseconds<br />
Output for 5.5.24
Func took 3.5610198974609 microseconds<br />
Output for 5.5.23
Func took 5.0270557403564 microseconds<br />
Output for 5.5.22
Func took 5.6240558624268 microseconds<br />
Output for 5.5.21
Func took 5.1741600036621 microseconds<br />
Output for 5.5.20
Func took 5.2731037139893 microseconds<br />
Output for 5.5.19
Func took 5.2521228790283 microseconds<br />
Output for 5.5.18
Func took 3.8790702819824 microseconds<br />
Output for 5.5.16
Func took 6.1781406402588 microseconds<br />
Output for 5.5.15
Func took 6.105899810791 microseconds<br />
Output for 5.5.14
Func took 4.0879249572754 microseconds<br />
Output for 5.5.13
Func took 6.1919689178467 microseconds<br />
Output for 5.5.12
Func took 5.6910514831543 microseconds<br />
Output for 5.5.10
Func took 5.0590038299561 microseconds<br />
Output for 5.5.9
Func took 4.7330856323242 microseconds<br />
Output for 5.5.8
Func took 5.7778358459473 microseconds<br />
Output for 5.5.7
Func took 5.8629512786865 microseconds<br />
Output for 5.5.6
Func took 6.9501399993896 microseconds<br />
Output for 5.5.5
Func took 5.8670043945312 microseconds<br />
Output for 5.5.4
Func took 5.6838989257812 microseconds<br />
Output for 5.5.3
Func took 5.6300163269043 microseconds<br />
Output for 5.5.2
Func took 5.6650638580322 microseconds<br />
Output for 5.5.1
Func took 5.5849552154541 microseconds<br />
Output for 5.5.0
Func took 5.1531791687012 microseconds<br />
Output for 5.4.45
Func took 3.5960674285889 microseconds<br />
Output for 5.4.44
Func took 4.4078826904297 microseconds<br />
Output for 5.4.43
Func took 3.5560131072998 microseconds<br />
Output for 5.4.42
Func took 4.0299892425537 microseconds<br />
Output for 5.4.41
Func took 3.5350322723389 microseconds<br />
Output for 5.4.40
Func took 3.5409927368164 microseconds<br />
Output for 5.4.39
Func took 5.1569938659668 microseconds<br />
Output for 5.4.38
Func took 5.8960914611816 microseconds<br />
Output for 5.4.37
Func took 6.3450336456299 microseconds<br />
Output for 5.4.36
Func took 5.8732032775879 microseconds<br />
Output for 5.4.35
Func took 5.1071643829346 microseconds<br />
Output for 5.4.34
Func took 5.8250427246094 microseconds<br />
Output for 5.4.32
Func took 5.9709548950195 microseconds<br />
Output for 5.4.31
Func took 6.2148571014404 microseconds<br />
Output for 5.4.30
Func took 4.0462017059326 microseconds<br />
Output for 5.4.29
Func took 6.0019493103027 microseconds<br />
Output for 5.4.28
Func took 4.9939155578613 microseconds<br />
Output for 5.4.27
Func took 5.3989887237549 microseconds<br />
Output for 5.4.26
Func took 5.6869983673096 microseconds<br />
Output for 5.4.25
Func took 3.8220882415771 microseconds<br />
Output for 5.4.24
Func took 7.1620941162109 microseconds<br />
Output for 5.4.23
Func took 5.789041519165 microseconds<br />
Output for 5.4.22
Func took 5.1920413970947 microseconds<br />
Output for 5.4.21
Func took 6.2460899353027 microseconds<br />
Output for 5.4.20
Func took 6.309986114502 microseconds<br />
Output for 5.4.19
Func took 6.1700344085693 microseconds<br />
Output for 5.4.18
Func took 5.964994430542 microseconds<br />
Output for 5.4.17
Func took 4.2197704315186 microseconds<br />
Output for 5.4.16
Func took 5.7010650634766 microseconds<br />
Output for 5.4.15
Func took 5.0759315490723 microseconds<br />
Output for 5.4.14
Func took 5.7060718536377 microseconds<br />
Output for 5.4.13
Func took 5.4330825805664 microseconds<br />
Output for 5.4.12
Func took 5.5451393127441 microseconds<br />
Output for 5.4.11
Func took 5.2261352539062 microseconds<br />
Output for 5.4.10
Func took 4.0411949157715 microseconds<br />
Output for 5.4.9
Func took 6.6239833831787 microseconds<br />
Output for 5.4.8
Func took 5.7549476623535 microseconds<br />
Output for 5.4.7
Func took 6.5388679504395 microseconds<br />
Output for 5.4.6
Func took 5.9940814971924 microseconds<br />
Output for 5.4.5
Func took 5.4271221160889 microseconds<br />
Output for 5.4.4
Func took 6.4859390258789 microseconds<br />
Output for 5.4.3
Func took 5.7828426361084 microseconds<br />
Output for 5.4.2
Func took 5.7430267333984 microseconds<br />
Output for 5.4.1
Func took 4.6701431274414 microseconds<br />
Output for 5.4.0
Func took 6.4189434051514 microseconds<br />
Output for 5.3.28
Func took 4.957914352417 microseconds<br />
Output for 5.3.27
Func took 5.8639049530029 microseconds<br />
Output for 5.3.26
Func took 5.9950351715088 microseconds<br />
Output for 5.3.25
Func took 5.9890747070312 microseconds<br />
Output for 5.3.24
Func took 5.9440135955811 microseconds<br />
Output for 5.3.23
Func took 5.9549808502197 microseconds<br />
Output for 5.3.22
Func took 4.0891170501709 microseconds<br />
Output for 5.3.20
Func took 4.0218830108643 microseconds<br />
Output for 5.3.19
Func took 4.3039321899414 microseconds<br />
Output for 5.3.18
Func took 4.8229694366455 microseconds<br />
Output for 5.3.17
Func took 4.3790340423584 microseconds<br />
Output for 5.3.16
Func took 4.1079521179199 microseconds<br />
Output for 5.3.15
Func took 6.1619281768799 microseconds<br />
Output for 5.3.14
Func took 6.5350532531738 microseconds<br />
Output for 5.3.13
Func took 6.566047668457 microseconds<br />
Output for 5.3.12
Func took 6.2410831451416 microseconds<br />
Output for 5.3.11
Func took 5.0520896911621 microseconds<br />
Output for 5.3.10
Func took 5.7699680328369 microseconds<br />
Output for 5.3.9
Func took 5.2239894866943 microseconds<br />
Output for 5.3.8
Func took 4.9669742584229 microseconds<br />
Output for 5.3.7
Func took 6.7930221557617 microseconds<br />
Output for 5.3.6
Func took 5.9471130371094 microseconds<br />
Output for 5.3.5
Func took 7.1520805358887 microseconds<br />
Output for 5.3.4
Func took 3.7820339202881 microseconds<br />
Output for 5.3.3
Func took 4.723072052002 microseconds<br />
Output for 5.3.2
Func took 5.8169364929199 microseconds<br />
Output for 5.3.1
Func took 5.7499408721924 microseconds<br />
Output for 5.3.0
Func took 6.5829753875732 microseconds<br />
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/hpaVQ 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/hpaVQ 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/hpaVQ on line 13
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_CLASS in /in/hpaVQ on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/hpaVQ on line 13
Process exited with code 255.

preferences:
170.17 ms | 401 KiB | 207 Q