3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $classmap1 = array(); for ($i=1; $i<=100; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=100; $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.1.0
Func took 0.015020370483398 microseconds<br />
Output for 7.0.14
Func took 0.017881393432617 microseconds<br />
Output for 7.0.5 - 7.0.6, 7.0.10
Func took 0.015974044799805 microseconds<br />
Output for 7.0.3, 7.0.9
Func took 0.016927719116211 microseconds<br />
Output for 7.0.8
Func took 0.026941299438477 microseconds<br />
Output for 7.0.7
Func took 0.018119812011719 microseconds<br />
Output for 7.0.2, 7.0.4
Func took 0.014066696166992 microseconds<br />
Output for 7.0.1
Func took 0.014781951904297 microseconds<br />
Output for 7.0.0
Func took 0.011920928955078 microseconds<br />
Output for 5.6.28
Func took 0.079154968261719 microseconds<br />
Output for 5.3.3, 5.3.18, 5.4.38, 5.6.25
Func took 0.082969665527344 microseconds<br />
Output for 5.3.2, 5.3.6, 5.3.10, 5.3.14, 5.4.11, 5.6.6, 5.6.24
Func took 0.076055526733398 microseconds<br />
Output for 5.3.11, 5.3.23, 5.3.28, 5.5.0, 5.5.33, 5.6.1, 5.6.14, 5.6.23
Func took 0.061988830566406 microseconds<br />
Output for 5.4.8, 5.4.26, 5.4.28, 5.4.44, 5.5.30, 5.5.37, 5.6.22
Func took 0.077962875366211 microseconds<br />
Output for 5.3.8, 5.5.23, 5.6.21
Func took 0.065088272094727 microseconds<br />
Output for 5.5.28, 5.5.35, 5.6.20
Func took 0.072956085205078 microseconds<br />
Output for 5.5.16, 5.6.11, 5.6.19
Func took 0.079870223999023 microseconds<br />
Output for 5.6.10, 5.6.18
Func took 0.066995620727539 microseconds<br />
Output for 5.4.29, 5.4.31, 5.5.29, 5.6.4, 5.6.16 - 5.6.17
Func took 0.072002410888672 microseconds<br />
Output for 5.3.9, 5.4.4, 5.6.8, 5.6.15
Func took 0.066041946411133 microseconds<br />
Output for 5.6.13
Func took 0.053882598876953 microseconds<br />
Output for 5.4.14, 5.6.12
Func took 0.067949295043945 microseconds<br />
Output for 5.4.15, 5.4.24, 5.4.42, 5.4.45, 5.5.7, 5.5.11, 5.5.14, 5.6.9
Func took 0.082015991210938 microseconds<br />
Output for 5.4.27, 5.5.36, 5.6.7
Func took 0.073909759521484 microseconds<br />
Output for 5.6.5
Func took 0.052213668823242 microseconds<br />
Output for 5.6.3
Func took 0.063896179199219 microseconds<br />
Output for 5.3.5, 5.4.0, 5.4.25, 5.6.2
Func took 0.077009201049805 microseconds<br />
Output for 5.3.0, 5.4.39, 5.4.43, 5.6.0
Func took 0.071048736572266 microseconds<br />
Output for 5.5.38
Func took 0.11110305786133 microseconds<br />
Output for 5.3.24, 5.5.34
Func took 0.056028366088867 microseconds<br />
Output for 5.3.29, 5.4.23, 5.4.34, 5.4.37, 5.5.10, 5.5.26, 5.5.32
Func took 0.078916549682617 microseconds<br />
Output for 5.5.31
Func took 0.058889389038086 microseconds<br />
Output for 5.3.13, 5.5.27
Func took 0.080108642578125 microseconds<br />
Output for 5.5.25
Func took 0.083208084106445 microseconds<br />
Output for 5.3.17, 5.4.22, 5.5.6, 5.5.12, 5.5.24
Func took 0.08392333984375 microseconds<br />
Output for 5.5.19, 5.5.22
Func took 0.087976455688477 microseconds<br />
Output for 5.3.7, 5.4.36, 5.5.21
Func took 0.085115432739258 microseconds<br />
Output for 5.5.13, 5.5.20
Func took 0.074148178100586 microseconds<br />
Output for 5.4.20, 5.4.41, 5.5.18
Func took 0.075101852416992 microseconds<br />
Output for 5.3.21, 5.4.32, 5.5.15
Func took 0.055074691772461 microseconds<br />
Output for 5.5.9
Func took 0.074863433837891 microseconds<br />
Output for 5.5.8
Func took 0.091075897216797 microseconds<br />
Output for 5.5.5
Func took 0.068902969360352 microseconds<br />
Output for 5.4.1, 5.4.13, 5.5.3 - 5.5.4
Func took 0.084877014160156 microseconds<br />
Output for 5.5.2
Func took 0.069141387939453 microseconds<br />
Output for 5.5.1
Func took 0.089168548583984 microseconds<br />
Output for 5.4.40
Func took 0.060081481933594 microseconds<br />
Output for 5.4.35
Func took 0.092029571533203 microseconds<br />
Output for 5.3.19, 5.4.6 - 5.4.7, 5.4.17, 5.4.30
Func took 0.081062316894531 microseconds<br />
Output for 5.4.21
Func took 0.095129013061523 microseconds<br />
Output for 5.4.19
Func took 0.05793571472168 microseconds<br />
Output for 5.4.2, 5.4.18
Func took 0.086069107055664 microseconds<br />
Output for 5.3.25, 5.4.16
Func took 0.08702278137207 microseconds<br />
Output for 5.3.22, 5.4.10, 5.4.12
Func took 0.056982040405273 microseconds<br />
Output for 5.4.9
Func took 0.092983245849609 microseconds<br />
Output for 5.4.5
Func took 0.078201293945312 microseconds<br />
Output for 5.4.3
Func took 0.10085105895996 microseconds<br />
Output for 5.3.27
Func took 0.049114227294922 microseconds<br />
Output for 5.3.26
Func took 0.06103515625 microseconds<br />
Output for 5.3.20
Func took 0.070095062255859 microseconds<br />
Output for 5.3.16
Func took 0.04887580871582 microseconds<br />
Output for 5.3.15
Func took 0.084161758422852 microseconds<br />
Output for 5.3.12
Func took 0.063180923461914 microseconds<br />
Output for 5.3.4
Func took 0.10204315185547 microseconds<br />
Output for 5.3.1
Func took 0.06413459777832 microseconds<br />
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/DdR9B 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/DdR9B 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/DdR9B 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/DdR9B on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/DdR9B on line 13
Process exited with code 255.