3v4l.org

run code in 300+ PHP versions simultaneously
<?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 (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.3.1
Func took 0.79798698425293 microseconds<br />
Output for 7.3.0
Func took 1.2738704681396 microseconds<br />
Output for 7.2.13
Func took 4.8580169677734 microseconds<br />
Output for 7.2.12
Func took 1.0111331939697 microseconds<br />
Output for 7.2.11
Func took 1.2350082397461 microseconds<br />
Output for 7.2.10
Func took 1.121997833252 microseconds<br />
Output for 7.2.9
Func took 0.91695785522461 microseconds<br />
Output for 7.2.8
Func took 1.0828971862793 microseconds<br />
Output for 7.2.7
Func took 1.0490417480469 microseconds<br />
Output for 7.2.6
Func took 0.92196464538574 microseconds<br />
Output for 7.2.5
Func took 1.0180473327637 microseconds<br />
Output for 7.2.4
Func took 6.6380500793457 microseconds<br />
Output for 7.2.3
Func took 4.9490928649902 microseconds<br />
Output for 7.2.2
Func took 0.89192390441895 microseconds<br />
Output for 7.2.1
Func took 0.75006484985352 microseconds<br />
Output for 7.2.0
Func took 0.75697898864746 microseconds<br />
Output for 7.1.25
Func took 1.1990070343018 microseconds<br />
Output for 7.1.7
Func took 1.0058879852295 microseconds<br />
Output for 7.1.6
Func took 1.3461112976074 microseconds<br />
Output for 7.1.5
Func took 1.3031959533691 microseconds<br />
Output for 7.1.0
Func took 1.0390281677246 microseconds<br />
Output for 7.0.20
Func took 0.54621696472168 microseconds<br />
Output for 7.0.14
Func took 0.80299377441406 microseconds<br />
Output for 7.0.6
Func took 0.58507919311523 microseconds<br />
Output for 7.0.5
Func took 0.49495697021484 microseconds<br />
Output for 7.0.4
Func took 0.76413154602051 microseconds<br />
Output for 7.0.3
Func took 0.56791305541992 microseconds<br />
Output for 7.0.2
Func took 0.73599815368652 microseconds<br />
Output for 7.0.1
Func took 0.88787078857422 microseconds<br />
Output for 7.0.0
Func took 1.194953918457 microseconds<br />
Output for 5.6.28
Func took 3.3519268035889 microseconds<br />
Output for 5.6.21
Func took 1.9710063934326 microseconds<br />
Output for 5.6.20
Func took 3.026008605957 microseconds<br />
Output for 5.6.19
Func took 2.7189254760742 microseconds<br />
Output for 5.6.18
Func took 2.8781890869141 microseconds<br />
Output for 5.6.17
Func took 2.7120113372803 microseconds<br />
Output for 5.6.16
Func took 2.1519660949707 microseconds<br />
Output for 5.6.15
Func took 2.6161670684814 microseconds<br />
Output for 5.6.14
Func took 3.3528804779053 microseconds<br />
Output for 5.6.13
Func took 2.9079914093018 microseconds<br />
Output for 5.6.12
Func took 2.0229816436768 microseconds<br />
Output for 5.6.11
Func took 2.007007598877 microseconds<br />
Output for 5.6.10
Func took 2.6440620422363 microseconds<br />
Output for 5.6.9
Func took 2.7308464050293 microseconds<br />
Output for 5.6.8
Func took 3.291130065918 microseconds<br />
Output for 5.5.35
Func took 3.2808780670166 microseconds<br />
Output for 5.5.34
Func took 2.6149749755859 microseconds<br />
Output for 5.5.33
Func took 2.112865447998 microseconds<br />
Output for 5.5.32
Func took 3.2088756561279 microseconds<br />
Output for 5.5.31
Func took 3.9219856262207 microseconds<br />
Output for 5.5.30
Func took 2.2468566894531 microseconds<br />
Output for 5.5.29
Func took 2.1228790283203 microseconds<br />
Output for 5.4.45, 5.5.28
Func took 3.2188892364502 microseconds<br />
Output for 5.5.27
Func took 2.5830268859863 microseconds<br />
Output for 5.5.26
Func took 2.8009414672852 microseconds<br />
Output for 5.5.25
Func took 3.2639503479004 microseconds<br />
Output for 5.5.24
Func took 2.6960372924805 microseconds<br />
Output for 5.4.44
Func took 3.3650398254395 microseconds<br />
Output for 5.4.43
Func took 3.3349990844727 microseconds<br />
Output for 5.4.42
Func took 3.2260417938232 microseconds<br />
Output for 5.4.41
Func took 3.3531188964844 microseconds<br />
Output for 5.4.40
Func took 3.2360553741455 microseconds<br />
Output for 5.4.39
Func took 3.3371448516846 microseconds<br />
Output for 5.4.38
Func took 2.4080276489258 microseconds<br />
Output for 5.4.37
Func took 2.4139881134033 microseconds<br />
Output for 5.4.36
Func took 3.2279491424561 microseconds<br />
Output for 5.4.35
Func took 3.3638477325439 microseconds<br />
Output for 5.4.34
Func took 3.3721923828125 microseconds<br />
Output for 5.4.32
Func took 3.4120082855225 microseconds<br />
Output for 5.4.31
Func took 3.2658576965332 microseconds<br />
Output for 5.4.30
Func took 2.5370121002197 microseconds<br />
Output for 5.4.29
Func took 3.2949447631836 microseconds<br />
Output for 5.4.28
Func took 2.720832824707 microseconds<br />
Output for 5.4.27
Func took 3.1149387359619 microseconds<br />
Output for 5.4.26
Func took 3.3900737762451 microseconds<br />
Output for 5.4.25
Func took 3.2510757446289 microseconds<br />
Output for 5.4.24
Func took 3.3588409423828 microseconds<br />
Output for 5.4.23
Func took 3.3388137817383 microseconds<br />
Output for 5.4.22
Func took 3.2129287719727 microseconds<br />
Output for 5.4.21
Func took 3.19504737854 microseconds<br />
Output for 5.4.20
Func took 2.7289390563965 microseconds<br />
Output for 5.3.14, 5.4.19
Func took 3.2830238342285 microseconds<br />
Output for 5.4.18
Func took 3.1609535217285 microseconds<br />
Output for 5.4.17
Func took 3.1938552856445 microseconds<br />
Output for 5.4.16
Func took 3.4708976745605 microseconds<br />
Output for 5.4.15
Func took 2.8378963470459 microseconds<br />
Output for 5.4.14
Func took 3.3810138702393 microseconds<br />
Output for 5.4.13
Func took 3.3068656921387 microseconds<br />
Output for 5.4.12
Func took 3.389835357666 microseconds<br />
Output for 5.4.11
Func took 3.1919479370117 microseconds<br />
Output for 5.4.10
Func took 3.497838973999 microseconds<br />
Output for 5.4.9
Func took 2.8090476989746 microseconds<br />
Output for 5.4.2, 5.4.8
Func took 3.4220218658447 microseconds<br />
Output for 5.3.20, 5.4.7
Func took 3.5619735717773 microseconds<br />
Output for 5.4.6
Func took 3.0498504638672 microseconds<br />
Output for 5.4.5
Func took 3.140926361084 microseconds<br />
Output for 5.4.4
Func took 3.4961700439453 microseconds<br />
Output for 5.4.3
Func took 3.3791065216064 microseconds<br />
Output for 5.4.1
Func took 3.0450820922852 microseconds<br />
Output for 5.4.0
Func took 3.3729076385498 microseconds<br />
Output for 5.3.29
Func took 3.4270286560059 microseconds<br />
Output for 5.3.28
Func took 3.0350685119629 microseconds<br />
Output for 5.3.27
Func took 2.8250217437744 microseconds<br />
Output for 5.3.26
Func took 3.5068988800049 microseconds<br />
Output for 5.3.25
Func took 3.4608840942383 microseconds<br />
Output for 5.3.24
Func took 3.7119388580322 microseconds<br />
Output for 5.3.23
Func took 3.4089088439941 microseconds<br />
Output for 5.3.22
Func took 3.1640529632568 microseconds<br />
Output for 5.3.21
Func took 3.2460689544678 microseconds<br />
Output for 5.3.19
Func took 3.572940826416 microseconds<br />
Output for 5.3.18
Func took 3.4430027008057 microseconds<br />
Output for 5.3.17
Func took 3.4079551696777 microseconds<br />
Output for 5.3.16
Func took 3.4267902374268 microseconds<br />
Output for 5.3.15
Func took 3.4630298614502 microseconds<br />
Output for 5.3.13
Func took 2.586841583252 microseconds<br />
Output for 5.3.12
Func took 3.5128593444824 microseconds<br />
Output for 5.3.11
Func took 3.9548873901367 microseconds<br />
Output for 5.3.10
Func took 3.6129951477051 microseconds<br />
Output for 5.3.9
Func took 2.3260116577148 microseconds<br />
Output for 5.3.8
Func took 2.903938293457 microseconds<br />
Output for 5.3.7
Func took 2.2871494293213 microseconds<br />
Output for 5.3.6
Func took 2.3350715637207 microseconds<br />
Output for 5.3.5
Func took 2.8071403503418 microseconds<br />
Output for 5.3.4
Func took 2.29811668396 microseconds<br />
Output for 5.3.3
Func took 3.0081272125244 microseconds<br />
Output for 5.3.2
Func took 2.1798610687256 microseconds<br />
Output for 5.3.1
Func took 2.2029876708984 microseconds<br />
Output for 5.3.0
Func took 2.7151107788086 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/egnKV 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/egnKV 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/egnKV 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/egnKV on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/egnKV on line 13
Process exited with code 255.

preferences:
129.15 ms | 401 KiB | 190 Q