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 (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; } } } } $startTimeFunc = microtime(true); merging::merge($classmap1, $classmap2); $endTimeFunc = microtime(true); echo "Func took " . (($endTimeFunc - $startTimeFunc)*1000) ." microseconds<br />\n"; //var_dump($am);
Output for 7.4.1
Func took 1.6999244689941 microseconds<br />
Output for 7.4.0
Func took 1.6469955444336 microseconds<br />
Output for 7.3.13
Func took 2.0380020141602 microseconds<br />
Output for 7.3.12
Func took 2.0499229431152 microseconds<br />
Output for 7.3.11
Func took 1.8830299377441 microseconds<br />
Output for 7.3.10
Func took 1.4071464538574 microseconds<br />
Output for 7.3.9
Func took 1.8420219421387 microseconds<br />
Output for 7.3.8
Func took 1.3360977172852 microseconds<br />
Output for 7.1.28, 7.3.7
Func took 1.6570091247559 microseconds<br />
Output for 7.3.6
Func took 1.6801357269287 microseconds<br />
Output for 7.3.5
Func took 1.6369819641113 microseconds<br />
Output for 7.3.4
Func took 1.4169216156006 microseconds<br />
Output for 7.3.3
Func took 1.4400482177734 microseconds<br />
Output for 7.3.2
Func took 1.3251304626465 microseconds<br />
Output for 7.3.1
Func took 1.1811256408691 microseconds<br />
Output for 7.3.0
Func took 1.1789798736572 microseconds<br />
Output for 7.2.26
Func took 2.0439624786377 microseconds<br />
Output for 7.2.25
Func took 1.8210411071777 microseconds<br />
Output for 7.2.24
Func took 1.4581680297852 microseconds<br />
Output for 7.2.23
Func took 1.4851093292236 microseconds<br />
Output for 7.2.22
Func took 1.8398761749268 microseconds<br />
Output for 7.2.21
Func took 1.6179084777832 microseconds<br />
Output for 7.2.20
Func took 1.5401840209961 microseconds<br />
Output for 7.2.19
Func took 1.4140605926514 microseconds<br />
Output for 7.2.18
Func took 1.4348030090332 microseconds<br />
Output for 7.2.17
Func took 1.453161239624 microseconds<br />
Output for 7.1.23, 7.2.16
Func took 1.5559196472168 microseconds<br />
Output for 7.2.15
Func took 1.3320446014404 microseconds<br />
Output for 7.2.14
Func took 1.2609958648682 microseconds<br />
Output for 7.2.13
Func took 1.248836517334 microseconds<br />
Output for 7.2.12
Func took 1.0509490966797 microseconds<br />
Output for 7.2.11
Func took 1.1320114135742 microseconds<br />
Output for 7.2.10
Func took 0.97894668579102 microseconds<br />
Output for 7.2.9
Func took 1.3670921325684 microseconds<br />
Output for 7.2.8
Func took 1.3809204101562 microseconds<br />
Output for 7.2.7
Func took 1.5320777893066 microseconds<br />
Output for 7.2.6
Func took 1.3229846954346 microseconds<br />
Output for 7.2.5
Func took 1.6918182373047 microseconds<br />
Output for 7.2.4
Func took 1.3508796691895 microseconds<br />
Output for 7.2.3
Func took 1.3101100921631 microseconds<br />
Output for 7.2.2
Func took 1.3980865478516 microseconds<br />
Output for 7.2.1
Func took 1.3289451599121 microseconds<br />
Output for 7.2.0
Func took 1.3720989227295 microseconds<br />
Output for 7.1.33
Func took 1.5220642089844 microseconds<br />
Output for 7.1.32
Func took 1.9769668579102 microseconds<br />
Output for 7.1.31
Func took 1.5311241149902 microseconds<br />
Output for 7.1.30
Func took 1.5408992767334 microseconds<br />
Output for 7.1.29
Func took 1.5120506286621 microseconds<br />
Output for 7.1.27
Func took 1.521110534668 microseconds<br />
Output for 7.1.26
Func took 1.5130043029785 microseconds<br />
Output for 7.1.25
Func took 1.5041828155518 microseconds<br />
Output for 7.1.24
Func took 1.5969276428223 microseconds<br />
Output for 7.1.22
Func took 1.5189647674561 microseconds<br />
Output for 7.1.21
Func took 1.9161701202393 microseconds<br />
Output for 7.1.20
Func took 1.5439987182617 microseconds<br />
Output for 7.1.19
Func took 1.7809867858887 microseconds<br />
Output for 7.1.18
Func took 1.7850399017334 microseconds<br />
Output for 7.1.17
Func took 1.5721321105957 microseconds<br />
Output for 7.1.16
Func took 2.079963684082 microseconds<br />
Output for 7.1.15
Func took 1.9290447235107 microseconds<br />
Output for 7.1.14
Func took 2.0091533660889 microseconds<br />
Output for 7.1.13
Func took 2.065896987915 microseconds<br />
Output for 7.1.12
Func took 2.0010471343994 microseconds<br />
Output for 7.1.11
Func took 2.0639896392822 microseconds<br />
Output for 7.1.10
Func took 1.8758773803711 microseconds<br />
Output for 7.1.9
Func took 1.9760131835938 microseconds<br />
Output for 7.1.8
Func took 1.9838809967041 microseconds<br />
Output for 7.1.7
Func took 1.5168190002441 microseconds<br />
Output for 7.1.6
Func took 2.0160675048828 microseconds<br />
Output for 7.1.5
Func took 1.9829273223877 microseconds<br />
Output for 7.1.4
Func took 1.9819736480713 microseconds<br />
Output for 7.1.3
Func took 1.4989376068115 microseconds<br />
Output for 7.1.2
Func took 1.8320083618164 microseconds<br />
Output for 7.1.1
Func took 1.54709815979 microseconds<br />
Output for 7.1.0
Func took 1.4867782592773 microseconds<br />
Output for 7.0.33
Func took 1.6238689422607 microseconds<br />
Output for 7.0.32
Func took 1.5139579772949 microseconds<br />
Output for 7.0.31
Func took 1.539945602417 microseconds<br />
Output for 7.0.30
Func took 2.0649433135986 microseconds<br />
Output for 7.0.29
Func took 1.7058849334717 microseconds<br />
Output for 7.0.28
Func took 2.039909362793 microseconds<br />
Output for 7.0.27
Func took 2.0818710327148 microseconds<br />
Output for 7.0.26
Func took 2.0270347595215 microseconds<br />
Output for 7.0.25
Func took 2.0630359649658 microseconds<br />
Output for 7.0.24
Func took 2.1090507507324 microseconds<br />
Output for 7.0.23
Func took 2.0980834960938 microseconds<br />
Output for 7.0.22
Func took 2.0530223846436 microseconds<br />
Output for 7.0.21
Func took 2.032995223999 microseconds<br />
Output for 7.0.20
Func took 2.0999908447266 microseconds<br />
Output for 7.0.19
Func took 2.0279884338379 microseconds<br />
Output for 7.0.18
Func took 2.0520687103271 microseconds<br />
Output for 7.0.17
Func took 2.1069049835205 microseconds<br />
Output for 7.0.16
Func took 1.5761852264404 microseconds<br />
Output for 7.0.15
Func took 2.112865447998 microseconds<br />
Output for 7.0.14
Func took 2.6609897613525 microseconds<br />
Output for 7.0.13
Func took 1.6241073608398 microseconds<br />
Output for 7.0.12
Func took 2.1491050720215 microseconds<br />
Output for 7.0.11
Func took 2.0809173583984 microseconds<br />
Output for 7.0.10
Func took 1.615047454834 microseconds<br />
Output for 7.0.9
Func took 3.209114074707 microseconds<br />
Output for 7.0.8
Func took 1.5850067138672 microseconds<br />
Output for 7.0.7
Func took 1.971960067749 microseconds<br />
Output for 7.0.6
Func took 2.0699501037598 microseconds<br />
Output for 7.0.5
Func took 2.0430088043213 microseconds<br />
Output for 7.0.4
Func took 2.0308494567871 microseconds<br />
Output for 7.0.3
Func took 2.0601749420166 microseconds<br />
Output for 7.0.2
Func took 1.8188953399658 microseconds<br />
Output for 7.0.1
Func took 1.6059875488281 microseconds<br />
Output for 7.0.0
Func took 1.9509792327881 microseconds<br />
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40

Process exited with code 137.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/Kt7XM 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/Kt7XM 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/Kt7XM 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/Kt7XM on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/Kt7XM on line 13
Process exited with code 255.

preferences:
196.06 ms | 401 KiB | 325 Q