3v4l.org

run code in 300+ PHP versions simultaneously
<?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.3.1
Func took 0.10800361633301 microseconds<br />
Output for 7.3.0
Func took 0.072002410888672 microseconds<br />
Output for 7.2.13
Func took 0.1070499420166 microseconds<br />
Output for 7.0.1, 7.2.12
Func took 0.081062316894531 microseconds<br />
Output for 7.2.11
Func took 0.1368522644043 microseconds<br />
Output for 7.2.10
Func took 0.11205673217773 microseconds<br />
Output for 7.2.9
Func took 0.11396408081055 microseconds<br />
Output for 7.2.8
Func took 0.12111663818359 microseconds<br />
Output for 7.2.7
Func took 0.079154968261719 microseconds<br />
Output for 7.2.6
Func took 0.089883804321289 microseconds<br />
Output for 7.2.5
Func took 0.14281272888184 microseconds<br />
Output for 7.2.4
Func took 0.12898445129395 microseconds<br />
Output for 7.2.3
Func took 0.090837478637695 microseconds<br />
Output for 7.2.2
Func took 0.11610984802246 microseconds<br />
Output for 7.2.1
Func took 0.10585784912109 microseconds<br />
Output for 7.2.0
Func took 0.10490417480469 microseconds<br />
Output for 7.1.25
Func took 0.17404556274414 microseconds<br />
Output for 7.1.7
Func took 0.056982040405273 microseconds<br />
Output for 7.1.6
Func took 0.13518333435059 microseconds<br />
Output for 7.1.5
Func took 0.12302398681641 microseconds<br />
Output for 7.1.0
Func took 0.079870223999023 microseconds<br />
Output for 7.0.4, 7.0.20
Func took 0.058889389038086 microseconds<br />
Output for 7.0.14
Func took 0.097036361694336 microseconds<br />
Output for 7.0.7
Func took 0.088930130004883 microseconds<br />
Output for 7.0.6
Func took 0.11706352233887 microseconds<br />
Output for 7.0.5
Func took 0.1068115234375 microseconds<br />
Output for 7.0.3
Func took 0.097990036010742 microseconds<br />
Output for 7.0.2
Func took 0.086069107055664 microseconds<br />
Output for 7.0.0
Func took 0.087976455688477 microseconds<br />
Output for 5.6.28
Func took 0.41794776916504 microseconds<br />
Output for 5.6.21
Func took 0.35905838012695 microseconds<br />
Output for 5.6.20
Func took 0.41294097900391 microseconds<br />
Output for 5.6.19
Func took 0.66089630126953 microseconds<br />
Output for 5.6.18
Func took 0.4580020904541 microseconds<br />
Output for 5.6.17
Func took 0.29397010803223 microseconds<br />
Output for 5.4.1, 5.6.16
Func took 0.32496452331543 microseconds<br />
Output for 5.6.15
Func took 0.37693977355957 microseconds<br />
Output for 5.6.14
Func took 0.27799606323242 microseconds<br />
Output for 5.6.13
Func took 0.39315223693848 microseconds<br />
Output for 5.6.12
Func took 0.37097930908203 microseconds<br />
Output for 5.6.11
Func took 0.28014183044434 microseconds<br />
Output for 5.6.10
Func took 0.37193298339844 microseconds<br />
Output for 5.6.9
Func took 0.30708312988281 microseconds<br />
Output for 5.4.14, 5.6.8
Func took 0.39792060852051 microseconds<br />
Output for 5.6.7
Func took 0.43010711669922 microseconds<br />
Output for 5.5.35
Func took 0.52380561828613 microseconds<br />
Output for 5.5.26, 5.5.34
Func took 0.35309791564941 microseconds<br />
Output for 5.5.33
Func took 0.47111511230469 microseconds<br />
Output for 5.5.32
Func took 0.30684471130371 microseconds<br />
Output for 5.5.31
Func took 0.50902366638184 microseconds<br />
Output for 5.5.30
Func took 0.44393539428711 microseconds<br />
Output for 5.5.29
Func took 0.24890899658203 microseconds<br />
Output for 5.5.28
Func took 0.28610229492188 microseconds<br />
Output for 5.4.7, 5.5.27
Func took 0.42104721069336 microseconds<br />
Output for 5.4.15, 5.5.25
Func took 0.33903121948242 microseconds<br />
Output for 5.5.24
Func took 0.30207633972168 microseconds<br />
Output for 5.4.45
Func took 0.38695335388184 microseconds<br />
Output for 5.4.37, 5.4.44
Func took 0.3809928894043 microseconds<br />
Output for 5.4.43
Func took 0.3969669342041 microseconds<br />
Output for 5.4.42
Func took 0.40197372436523 microseconds<br />
Output for 5.4.41
Func took 0.30303001403809 microseconds<br />
Output for 5.3.3, 5.3.28, 5.4.36, 5.4.40
Func took 0.28204917907715 microseconds<br />
Output for 5.3.9, 5.4.39
Func took 0.42510032653809 microseconds<br />
Output for 5.4.38
Func took 0.34999847412109 microseconds<br />
Output for 5.4.35
Func took 0.32687187194824 microseconds<br />
Output for 5.4.34
Func took 0.44989585876465 microseconds<br />
Output for 5.4.16, 5.4.32
Func took 0.40388107299805 microseconds<br />
Output for 5.4.31
Func took 0.4119873046875 microseconds<br />
Output for 5.4.3, 5.4.30
Func took 0.36406517028809 microseconds<br />
Output for 5.4.29
Func took 0.36501884460449 microseconds<br />
Output for 5.4.28
Func took 0.4420280456543 microseconds<br />
Output for 5.4.27
Func took 0.45013427734375 microseconds<br />
Output for 5.4.26
Func took 0.40602684020996 microseconds<br />
Output for 5.4.25
Func took 0.41985511779785 microseconds<br />
Output for 5.4.24
Func took 0.40793418884277 microseconds<br />
Output for 5.4.23
Func took 0.36120414733887 microseconds<br />
Output for 5.4.22
Func took 0.27918815612793 microseconds<br />
Output for 5.4.21
Func took 0.27704238891602 microseconds<br />
Output for 5.4.20
Func took 0.34403800964355 microseconds<br />
Output for 5.4.19
Func took 0.43702125549316 microseconds<br />
Output for 5.4.18
Func took 0.45299530029297 microseconds<br />
Output for 5.4.17
Func took 0.40292739868164 microseconds<br />
Output for 5.4.13
Func took 0.38909912109375 microseconds<br />
Output for 5.4.12
Func took 0.3960132598877 microseconds<br />
Output for 5.4.11
Func took 0.39100646972656 microseconds<br />
Output for 5.4.2, 5.4.10
Func took 0.37598609924316 microseconds<br />
Output for 5.3.22, 5.4.9
Func took 0.43296813964844 microseconds<br />
Output for 5.4.8
Func took 0.45609474182129 microseconds<br />
Output for 5.4.6
Func took 0.41413307189941 microseconds<br />
Output for 5.4.5
Func took 0.48303604125977 microseconds<br />
Output for 5.4.4
Func took 0.40507316589355 microseconds<br />
Output for 5.4.0
Func took 0.36907196044922 microseconds<br />
Output for 5.3.29
Func took 0.40006637573242 microseconds<br />
Output for 5.3.27
Func took 0.43201446533203 microseconds<br />
Output for 5.3.26
Func took 0.33807754516602 microseconds<br />
Output for 5.3.25
Func took 0.31280517578125 microseconds<br />
Output for 5.3.0, 5.3.24
Func took 0.33402442932129 microseconds<br />
Output for 5.3.23
Func took 0.40912628173828 microseconds<br />
Output for 5.3.21
Func took 0.40721893310547 microseconds<br />
Output for 5.3.20
Func took 0.39410591125488 microseconds<br />
Output for 5.3.12, 5.3.19
Func took 0.43511390686035 microseconds<br />
Output for 5.3.18
Func took 0.4270076751709 microseconds<br />
Output for 5.3.17
Func took 0.3819465637207 microseconds<br />
Output for 5.3.16
Func took 0.36215782165527 microseconds<br />
Output for 5.3.15
Func took 0.43797492980957 microseconds<br />
Output for 5.3.14
Func took 0.44012069702148 microseconds<br />
Output for 5.3.13
Func took 0.43606758117676 microseconds<br />
Output for 5.3.11
Func took 0.40888786315918 microseconds<br />
Output for 5.3.10
Func took 0.42200088500977 microseconds<br />
Output for 5.3.8
Func took 0.40984153747559 microseconds<br />
Output for 5.3.7
Func took 0.41484832763672 microseconds<br />
Output for 5.3.6
Func took 0.46610832214355 microseconds<br />
Output for 5.3.5
Func took 0.47397613525391 microseconds<br />
Output for 5.3.4
Func took 0.44703483581543 microseconds<br />
Output for 5.3.2
Func took 0.43106079101562 microseconds<br />
Output for 5.3.1
Func took 0.43892860412598 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/3rGij 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/3rGij 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/3rGij 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/3rGij on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/3rGij on line 13
Process exited with code 255.

preferences:
161.68 ms | 401 KiB | 192 Q