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 (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.0.4, 7.1.0
Func took 0.010967254638672 microseconds<br />
Output for 7.0.8, 7.0.14
Func took 0.015020370483398 microseconds<br />
Output for 7.0.10
Func took 0.019073486328125 microseconds<br />
Output for 7.0.0, 7.0.9
Func took 0.014066696166992 microseconds<br />
Output for 7.0.7
Func took 0.018835067749023 microseconds<br />
Output for 7.0.6
Func took 0.017881393432617 microseconds<br />
Output for 7.0.5
Func took 0.020027160644531 microseconds<br />
Output for 7.0.3
Func took 0.01215934753418 microseconds<br />
Output for 7.0.2
Func took 0.013113021850586 microseconds<br />
Output for 7.0.1
Func took 0.0078678131103516 microseconds<br />
Output for 5.4.29, 5.6.28
Func took 0.060081481933594 microseconds<br />
Output for 5.6.25
Func took 0.069141387939453 microseconds<br />
Output for 5.4.37, 5.5.0, 5.5.3, 5.5.8, 5.5.37, 5.6.24
Func took 0.055074691772461 microseconds<br />
Output for 5.4.0, 5.4.2, 5.4.20, 5.4.23, 5.6.23
Func took 0.041007995605469 microseconds<br />
Output for 5.5.33, 5.6.22
Func took 0.066041946411133 microseconds<br />
Output for 5.4.5, 5.4.9, 5.4.21, 5.4.24, 5.4.36, 5.6.21
Func took 0.041961669921875 microseconds<br />
Output for 5.6.20
Func took 0.068902969360352 microseconds<br />
Output for 5.3.6, 5.4.27, 5.4.30, 5.5.30, 5.6.19
Func took 0.06103515625 microseconds<br />
Output for 5.3.13, 5.5.20, 5.6.1, 5.6.18
Func took 0.056028366088867 microseconds<br />
Output for 5.4.22, 5.4.25, 5.6.17
Func took 0.051975250244141 microseconds<br />
Output for 5.6.16
Func took 0.040769577026367 microseconds<br />
Output for 5.5.1, 5.5.13, 5.6.15
Func took 0.067949295043945 microseconds<br />
Output for 5.4.39, 5.4.45, 5.6.14
Func took 0.04887580871582 microseconds<br />
Output for 5.3.9, 5.5.10, 5.5.38, 5.6.13
Func took 0.052928924560547 microseconds<br />
Output for 5.6.12
Func took 0.049829483032227 microseconds<br />
Output for 5.6.3, 5.6.11
Func took 0.064849853515625 microseconds<br />
Output for 5.5.5, 5.5.7, 5.6.10
Func took 0.045061111450195 microseconds<br />
Output for 5.4.31, 5.4.44, 5.5.36, 5.6.9
Func took 0.046014785766602 microseconds<br />
Output for 5.4.15, 5.4.32, 5.6.8
Func took 0.063896179199219 microseconds<br />
Output for 5.4.18, 5.6.7
Func took 0.056982040405273 microseconds<br />
Output for 5.3.11, 5.3.14, 5.3.17, 5.3.26, 5.5.2, 5.6.6
Func took 0.036954879760742 microseconds<br />
Output for 5.6.5
Func took 0.054121017456055 microseconds<br />
Output for 5.6.4
Func took 0.078201293945312 microseconds<br />
Output for 5.6.2
Func took 0.044822692871094 microseconds<br />
Output for 5.6.0
Func took 0.048160552978516 microseconds<br />
Output for 5.3.29, 5.5.35
Func took 0.058174133300781 microseconds<br />
Output for 5.4.8, 5.5.4, 5.5.34
Func took 0.043153762817383 microseconds<br />
Output for 5.4.38, 5.5.32
Func took 0.065088272094727 microseconds<br />
Output for 5.4.10, 5.4.17, 5.5.31
Func took 0.044107437133789 microseconds<br />
Output for 5.5.29
Func took 0.066995620727539 microseconds<br />
Output for 5.5.24, 5.5.28
Func took 0.062942504882812 microseconds<br />
Output for 5.4.41, 5.5.27
Func took 0.046968460083008 microseconds<br />
Output for 5.5.26
Func took 0.072002410888672 microseconds<br />
Output for 5.5.25
Func took 0.073909759521484 microseconds<br />
Output for 5.3.5, 5.5.15, 5.5.23
Func took 0.050067901611328 microseconds<br />
Output for 5.5.22
Func took 0.058889389038086 microseconds<br />
Output for 5.4.35, 5.4.43, 5.5.21
Func took 0.05793571472168 microseconds<br />
Output for 5.5.19
Func took 0.053882598876953 microseconds<br />
Output for 5.5.18
Func took 0.050783157348633 microseconds<br />
Output for 5.5.11, 5.5.16
Func took 0.054836273193359 microseconds<br />
Output for 5.5.14
Func took 0.053167343139648 microseconds<br />
Output for 5.3.10, 5.3.20, 5.3.23, 5.5.6, 5.5.12
Func took 0.037908554077148 microseconds<br />
Output for 5.4.12, 5.4.40, 5.5.9
Func took 0.061988830566406 microseconds<br />
Output for 5.4.42
Func took 0.070095062255859 microseconds<br />
Output for 5.4.14, 5.4.34
Func took 0.047922134399414 microseconds<br />
Output for 5.3.4, 5.3.7, 5.4.3, 5.4.28
Func took 0.040054321289062 microseconds<br />
Output for 5.4.26
Func took 0.065803527832031 microseconds<br />
Output for 5.4.19
Func took 0.074863433837891 microseconds<br />
Output for 5.4.16
Func took 0.055789947509766 microseconds<br />
Output for 5.3.25, 5.4.13
Func took 0.043869018554688 microseconds<br />
Output for 5.4.11
Func took 0.034093856811523 microseconds<br />
Output for 5.3.24, 5.4.7
Func took 0.042915344238281 microseconds<br />
Output for 5.3.19, 5.4.1, 5.4.6
Func took 0.039815902709961 microseconds<br />
Output for 5.4.4
Func took 0.036001205444336 microseconds<br />
Output for 5.3.28
Func took 0.059127807617188 microseconds<br />
Output for 5.3.1, 5.3.27
Func took 0.039100646972656 microseconds<br />
Output for 5.3.21 - 5.3.22
Func took 0.03814697265625 microseconds<br />
Output for 5.3.18
Func took 0.038862228393555 microseconds<br />
Output for 5.3.0, 5.3.16
Func took 0.037193298339844 microseconds<br />
Output for 5.3.15
Func took 0.032901763916016 microseconds<br />
Output for 5.3.3, 5.3.12
Func took 0.031948089599609 microseconds<br />
Output for 5.3.2, 5.3.8
Func took 0.032186508178711 microseconds<br />
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/ZNGa6 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/ZNGa6 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/ZNGa6 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/ZNGa6 on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/ZNGa6 on line 13
Process exited with code 255.