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])) { 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.76198577880859 microseconds<br />
Output for 7.0.14
Func took 0.64897537231445 microseconds<br />
Output for 7.0.7
Func took 0.53286552429199 microseconds<br />
Output for 7.0.6
Func took 0.75292587280273 microseconds<br />
Output for 7.0.5
Func took 0.65994262695312 microseconds<br />
Output for 7.0.4
Func took 0.71001052856445 microseconds<br />
Output for 7.0.3
Func took 0.71310997009277 microseconds<br />
Output for 7.0.2
Func took 0.64301490783691 microseconds<br />
Output for 7.0.1
Func took 0.74315071105957 microseconds<br />
Output for 7.0.0
Func took 0.78010559082031 microseconds<br />
Output for 5.6.28
Func took 2.1729469299316 microseconds<br />
Output for 5.6.22
Func took 1.5850067138672 microseconds<br />
Output for 5.6.21
Func took 1.7259120941162 microseconds<br />
Output for 5.3.28, 5.6.20
Func took 2.1908283233643 microseconds<br />
Output for 5.5.18, 5.6.11, 5.6.19
Func took 2.11501121521 microseconds<br />
Output for 5.5.30, 5.6.18
Func took 2.1798610687256 microseconds<br />
Output for 5.6.17
Func took 2.0031929016113 microseconds<br />
Output for 5.6.16
Func took 1.7008781433105 microseconds<br />
Output for 5.6.15
Func took 2.0179748535156 microseconds<br />
Output for 5.6.14
Func took 2.112865447998 microseconds<br />
Output for 5.6.13
Func took 2.1219253540039 microseconds<br />
Output for 5.6.12
Func took 2.039909362793 microseconds<br />
Output for 5.6.10
Func took 2.3660659790039 microseconds<br />
Output for 5.6.9
Func took 1.7158985137939 microseconds<br />
Output for 5.6.8
Func took 2.2351741790771 microseconds<br />
Output for 5.6.7
Func took 2.065896987915 microseconds<br />
Output for 5.6.6
Func took 1.8830299377441 microseconds<br />
Output for 5.6.5
Func took 2.0301342010498 microseconds<br />
Output for 5.6.4
Func took 2.0768642425537 microseconds<br />
Output for 5.6.3
Func took 2.0389556884766 microseconds<br />
Output for 5.6.2
Func took 2.2318363189697 microseconds<br />
Output for 5.6.1
Func took 2.1448135375977 microseconds<br />
Output for 5.6.0
Func took 2.1870136260986 microseconds<br />
Output for 5.5.36
Func took 1.9869804382324 microseconds<br />
Output for 5.5.35
Func took 2.2978782653809 microseconds<br />
Output for 5.4.40, 5.5.34
Func took 2.2408962249756 microseconds<br />
Output for 5.5.33
Func took 2.2599697113037 microseconds<br />
Output for 5.5.32
Func took 1.9838809967041 microseconds<br />
Output for 5.5.31
Func took 2.2060871124268 microseconds<br />
Output for 5.5.29
Func took 2.1770000457764 microseconds<br />
Output for 5.5.28
Func took 2.0761489868164 microseconds<br />
Output for 5.5.27
Func took 2.007007598877 microseconds<br />
Output for 5.5.26
Func took 1.7318725585938 microseconds<br />
Output for 5.5.25
Func took 2.1851062774658 microseconds<br />
Output for 5.5.24
Func took 2.2680759429932 microseconds<br />
Output for 5.5.23
Func took 2.05397605896 microseconds<br />
Output for 5.5.22
Func took 2.2280216217041 microseconds<br />
Output for 5.5.21
Func took 2.0449161529541 microseconds<br />
Output for 5.5.20
Func took 2.284049987793 microseconds<br />
Output for 5.5.19
Func took 1.7960071563721 microseconds<br />
Output for 5.5.16
Func took 2.8018951416016 microseconds<br />
Output for 5.5.15
Func took 2.01416015625 microseconds<br />
Output for 5.5.14
Func took 2.4650096893311 microseconds<br />
Output for 5.5.13
Func took 1.633882522583 microseconds<br />
Output for 5.5.12
Func took 2.1500587463379 microseconds<br />
Output for 5.5.11
Func took 1.9638538360596 microseconds<br />
Output for 5.5.10
Func took 1.9681453704834 microseconds<br />
Output for 5.5.9
Func took 2.0120143890381 microseconds<br />
Output for 5.5.8
Func took 2.183198928833 microseconds<br />
Output for 5.4.25, 5.5.7
Func took 2.2780895233154 microseconds<br />
Output for 5.5.6
Func took 2.3360252380371 microseconds<br />
Output for 5.5.5
Func took 2.5181770324707 microseconds<br />
Output for 5.5.4
Func took 2.1519660949707 microseconds<br />
Output for 5.5.3
Func took 2.1910667419434 microseconds<br />
Output for 5.4.13, 5.5.2
Func took 2.094030380249 microseconds<br />
Output for 5.5.1
Func took 2.1829605102539 microseconds<br />
Output for 5.5.0
Func took 2.1259784698486 microseconds<br />
Output for 5.4.45
Func took 1.9330978393555 microseconds<br />
Output for 5.4.44
Func took 2.230167388916 microseconds<br />
Output for 5.4.43
Func took 2.0902156829834 microseconds<br />
Output for 5.4.42
Func took 2.2339820861816 microseconds<br />
Output for 5.4.41
Func took 2.1419525146484 microseconds<br />
Output for 5.4.39
Func took 1.9509792327881 microseconds<br />
Output for 5.4.38
Func took 1.6529560089111 microseconds<br />
Output for 5.4.37
Func took 2.1820068359375 microseconds<br />
Output for 5.4.36
Func took 2.0859241485596 microseconds<br />
Output for 5.4.35
Func took 2.2420883178711 microseconds<br />
Output for 5.4.34
Func took 2.0937919616699 microseconds<br />
Output for 5.4.32
Func took 2.2950172424316 microseconds<br />
Output for 5.4.31
Func took 2.2289752960205 microseconds<br />
Output for 5.4.30
Func took 2.0220279693604 microseconds<br />
Output for 5.4.29
Func took 2.3038387298584 microseconds<br />
Output for 5.4.4, 5.4.28
Func took 2.2380352020264 microseconds<br />
Output for 5.4.27
Func took 2.0051002502441 microseconds<br />
Output for 5.4.26
Func took 2.1491050720215 microseconds<br />
Output for 5.4.24
Func took 2.1049976348877 microseconds<br />
Output for 5.4.23
Func took 2.4728775024414 microseconds<br />
Output for 5.4.22
Func took 2.2170543670654 microseconds<br />
Output for 5.4.21
Func took 2.3138523101807 microseconds<br />
Output for 5.4.20
Func took 2.3171901702881 microseconds<br />
Output for 5.4.19
Func took 1.7731189727783 microseconds<br />
Output for 5.4.18
Func took 2.1460056304932 microseconds<br />
Output for 5.4.5, 5.4.17
Func took 2.3190975189209 microseconds<br />
Output for 5.4.16
Func took 2.3279190063477 microseconds<br />
Output for 5.4.15
Func took 2.3081302642822 microseconds<br />
Output for 5.4.14
Func took 2.0740032196045 microseconds<br />
Output for 5.4.12
Func took 2.2149085998535 microseconds<br />
Output for 5.4.11
Func took 2.4700164794922 microseconds<br />
Output for 5.4.10
Func took 2.4280548095703 microseconds<br />
Output for 5.4.9
Func took 2.0320415496826 microseconds<br />
Output for 5.4.8
Func took 2.1970272064209 microseconds<br />
Output for 5.4.7
Func took 2.6719570159912 microseconds<br />
Output for 5.4.6
Func took 2.3250579833984 microseconds<br />
Output for 5.4.3
Func took 2.0990371704102 microseconds<br />
Output for 5.4.2
Func took 2.29811668396 microseconds<br />
Output for 5.4.1
Func took 2.000093460083 microseconds<br />
Output for 5.4.0
Func took 2.223014831543 microseconds<br />
Output for 5.3.29
Func took 2.2039413452148 microseconds<br />
Output for 5.3.27
Func took 2.3541450500488 microseconds<br />
Output for 5.3.26
Func took 2.2051334381104 microseconds<br />
Output for 5.3.25
Func took 2.3620128631592 microseconds<br />
Output for 5.3.24
Func took 2.1340847015381 microseconds<br />
Output for 5.3.23
Func took 1.9710063934326 microseconds<br />
Output for 5.3.22
Func took 2.2861957550049 microseconds<br />
Output for 5.3.21
Func took 2.1648406982422 microseconds<br />
Output for 5.3.20
Func took 2.349853515625 microseconds<br />
Output for 5.3.19
Func took 1.957893371582 microseconds<br />
Output for 5.3.18
Func took 2.1541118621826 microseconds<br />
Output for 5.3.17
Func took 2.2358894348145 microseconds<br />
Output for 5.3.16
Func took 2.2521018981934 microseconds<br />
Output for 5.3.15
Func took 1.6770362854004 microseconds<br />
Output for 5.3.14
Func took 2.4080276489258 microseconds<br />
Output for 5.3.13
Func took 2.0918846130371 microseconds<br />
Output for 5.3.12
Func took 2.2392272949219 microseconds<br />
Output for 5.3.11
Func took 2.4900436401367 microseconds<br />
Output for 5.3.10
Func took 2.4430751800537 microseconds<br />
Output for 5.3.9
Func took 2.5742053985596 microseconds<br />
Output for 5.3.8
Func took 2.4838447570801 microseconds<br />
Output for 5.3.7
Func took 2.0079612731934 microseconds<br />
Output for 5.3.6
Func took 1.7769336700439 microseconds<br />
Output for 5.3.5
Func took 2.6400089263916 microseconds<br />
Output for 5.3.4
Func took 1.9159317016602 microseconds<br />
Output for 5.3.3
Func took 2.0580291748047 microseconds<br />
Output for 5.3.2
Func took 1.6410350799561 microseconds<br />
Output for 5.3.1
Func took 2.4480819702148 microseconds<br />
Output for 5.3.0
Func took 2.6938915252686 microseconds<br />
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/ubuVs 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/ubuVs 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/ubuVs 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/ubuVs on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ubuVs on line 13
Process exited with code 255.