3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=500; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=500; $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.0.5, 7.2.1, 7.3.1
Func took 0.08392333984375 microseconds<br />
Output for 7.3.0
Func took 0.079870223999023 microseconds<br />
Output for 7.2.13
Func took 0.094890594482422 microseconds<br />
Output for 7.2.12
Func took 0.060081481933594 microseconds<br />
Output for 7.2.11
Func took 0.10013580322266 microseconds<br />
Output for 7.2.10
Func took 0.066995620727539 microseconds<br />
Output for 7.2.9
Func took 0.079154968261719 microseconds<br />
Output for 7.2.8
Func took 0.11515617370605 microseconds<br />
Output for 7.2.7
Func took 0.082015991210938 microseconds<br />
Output for 7.2.6
Func took 0.082969665527344 microseconds<br />
Output for 7.2.5
Func took 0.056982040405273 microseconds<br />
Output for 7.2.4
Func took 0.065088272094727 microseconds<br />
Output for 7.0.1, 7.0.7, 7.0.10, 7.2.3
Func took 0.056028366088867 microseconds<br />
Output for 7.2.2
Func took 0.072956085205078 microseconds<br />
Output for 7.2.0
Func took 0.084161758422852 microseconds<br />
Output for 7.1.25
Func took 0.10991096496582 microseconds<br />
Output for 7.1.7
Func took 0.041007995605469 microseconds<br />
Output for 7.1.6
Func took 0.095844268798828 microseconds<br />
Output for 7.1.5
Func took 0.11110305786133 microseconds<br />
Output for 7.1.0
Func took 0.092029571533203 microseconds<br />
Output for 7.0.20
Func took 0.046014785766602 microseconds<br />
Output for 7.0.14
Func took 0.066041946411133 microseconds<br />
Output for 7.0.9
Func took 0.077962875366211 microseconds<br />
Output for 7.0.8
Func took 0.05793571472168 microseconds<br />
Output for 7.0.6
Func took 0.087976455688477 microseconds<br />
Output for 7.0.4
Func took 0.063180923461914 microseconds<br />
Output for 7.0.3
Func took 0.041961669921875 microseconds<br />
Output for 7.0.2
Func took 0.044107437133789 microseconds<br />
Output for 7.0.0
Func took 0.058889389038086 microseconds<br />
Output for 5.6.28
Func took 0.32877922058105 microseconds<br />
Output for 5.5.31, 5.6.25
Func took 0.34093856811523 microseconds<br />
Output for 5.5.29, 5.6.24
Func took 0.31208992004395 microseconds<br />
Output for 5.6.23
Func took 0.30994415283203 microseconds<br />
Output for 5.4.14, 5.5.11, 5.5.19, 5.6.0, 5.6.22
Func took 0.21100044250488 microseconds<br />
Output for 5.6.21
Func took 0.32806396484375 microseconds<br />
Output for 5.5.34, 5.6.20
Func took 0.31113624572754 microseconds<br />
Output for 5.6.19
Func took 0.29802322387695 microseconds<br />
Output for 5.6.18
Func took 0.27203559875488 microseconds<br />
Output for 5.6.17
Func took 0.25391578674316 microseconds<br />
Output for 5.6.16
Func took 0.36811828613281 microseconds<br />
Output for 5.6.15
Func took 0.24700164794922 microseconds<br />
Output for 5.3.3, 5.6.14
Func took 0.23198127746582 microseconds<br />
Output for 5.6.13
Func took 0.34213066101074 microseconds<br />
Output for 5.6.12
Func took 0.28491020202637 microseconds<br />
Output for 5.6.11
Func took 0.22506713867188 microseconds<br />
Output for 5.6.10
Func took 0.3211498260498 microseconds<br />
Output for 5.3.1, 5.6.9
Func took 0.30803680419922 microseconds<br />
Output for 5.6.8
Func took 0.22387504577637 microseconds<br />
Output for 5.6.7
Func took 0.20909309387207 microseconds<br />
Output for 5.3.14, 5.6.6
Func took 0.1990795135498 microseconds<br />
Output for 5.4.22, 5.4.36, 5.5.8, 5.6.1, 5.6.5
Func took 0.2129077911377 microseconds<br />
Output for 5.5.0, 5.5.18, 5.6.4
Func took 0.20503997802734 microseconds<br />
Output for 5.4.5, 5.5.12, 5.6.3
Func took 0.21696090698242 microseconds<br />
Output for 5.6.2
Func took 0.20003318786621 microseconds<br />
Output for 5.5.38
Func took 0.25296211242676 microseconds<br />
Output for 5.5.37
Func took 0.32901763916016 microseconds<br />
Output for 5.5.36
Func took 0.30612945556641 microseconds<br />
Output for 5.5.35
Func took 0.26893615722656 microseconds<br />
Output for 5.5.33
Func took 0.34284591674805 microseconds<br />
Output for 5.5.32
Func took 0.30398368835449 microseconds<br />
Output for 5.5.30
Func took 0.27012825012207 microseconds<br />
Output for 5.5.27 - 5.5.28
Func took 0.33211708068848 microseconds<br />
Output for 5.5.26
Func took 0.34785270690918 microseconds<br />
Output for 5.4.29, 5.5.25
Func took 0.29993057250977 microseconds<br />
Output for 5.5.24
Func took 0.43106079101562 microseconds<br />
Output for 5.5.23
Func took 0.21815299987793 microseconds<br />
Output for 5.3.13, 5.4.27, 5.5.10, 5.5.20, 5.5.22
Func took 0.21600723266602 microseconds<br />
Output for 5.5.21
Func took 0.34403800964355 microseconds<br />
Output for 5.3.17, 5.5.16
Func took 0.20694732666016 microseconds<br />
Output for 5.5.15
Func took 0.31709671020508 microseconds<br />
Output for 5.5.14
Func took 0.18095970153809 microseconds<br />
Output for 5.5.13
Func took 0.35595893859863 microseconds<br />
Output for 5.5.9
Func took 0.20980834960938 microseconds<br />
Output for 5.4.39, 5.5.3, 5.5.7
Func took 0.2140998840332 microseconds<br />
Output for 5.3.15, 5.3.25, 5.4.38, 5.5.6
Func took 0.21195411682129 microseconds<br />
Output for 5.5.5
Func took 0.29683113098145 microseconds<br />
Output for 5.4.9, 5.5.4
Func took 0.22006034851074 microseconds<br />
Output for 5.4.37, 5.5.2
Func took 0.22101402282715 microseconds<br />
Output for 5.4.10, 5.5.1
Func took 0.20790100097656 microseconds<br />
Output for 5.4.45
Func took 0.35905838012695 microseconds<br />
Output for 5.3.0, 5.4.44
Func took 0.35500526428223 microseconds<br />
Output for 5.4.43
Func took 0.33712387084961 microseconds<br />
Output for 5.3.7, 5.4.42
Func took 0.31900405883789 microseconds<br />
Output for 5.4.41
Func took 0.44989585876465 microseconds<br />
Output for 5.4.40
Func took 0.24199485778809 microseconds<br />
Output for 5.4.35
Func took 0.2739429473877 microseconds<br />
Output for 5.3.26, 5.4.8, 5.4.11, 5.4.32 - 5.4.34
Func took 0.20599365234375 microseconds<br />
Output for 5.4.31
Func took 0.17189979553223 microseconds<br />
Output for 5.4.30
Func took 0.32305717468262 microseconds<br />
Output for 5.4.28
Func took 0.26702880859375 microseconds<br />
Output for 5.4.26
Func took 0.2899169921875 microseconds<br />
Output for 5.4.23, 5.4.25
Func took 0.22697448730469 microseconds<br />
Output for 5.4.24
Func took 0.33307075500488 microseconds<br />
Output for 5.3.20, 5.3.24, 5.4.21
Func took 0.21505355834961 microseconds<br />
Output for 5.4.20
Func took 0.40698051452637 microseconds<br />
Output for 5.4.19
Func took 0.30207633972168 microseconds<br />
Output for 5.3.19, 5.4.18
Func took 0.2131462097168 microseconds<br />
Output for 5.4.17
Func took 0.20813941955566 microseconds<br />
Output for 5.4.16
Func took 0.20098686218262 microseconds<br />
Output for 5.4.15
Func took 0.17285346984863 microseconds<br />
Output for 5.4.13
Func took 0.17714500427246 microseconds<br />
Output for 5.4.12
Func took 0.20885467529297 microseconds<br />
Output for 5.4.7
Func took 0.19097328186035 microseconds<br />
Output for 5.4.4, 5.4.6
Func took 0.20194053649902 microseconds<br />
Output for 5.4.3
Func took 0.18000602722168 microseconds<br />
Output for 5.4.2
Func took 0.29516220092773 microseconds<br />
Output for 5.4.1
Func took 0.25010108947754 microseconds<br />
Output for 5.4.0
Func took 0.24604797363281 microseconds<br />
Output for 5.3.29
Func took 0.19216537475586 microseconds<br />
Output for 5.3.28
Func took 0.22411346435547 microseconds<br />
Output for 5.3.27
Func took 0.35619735717773 microseconds<br />
Output for 5.3.23
Func took 0.38909912109375 microseconds<br />
Output for 5.3.22
Func took 0.17786026000977 microseconds<br />
Output for 5.3.21
Func took 0.17690658569336 microseconds<br />
Output for 5.3.18
Func took 0.39315223693848 microseconds<br />
Output for 5.3.16
Func took 0.26202201843262 microseconds<br />
Output for 5.3.12
Func took 0.18692016601562 microseconds<br />
Output for 5.3.11
Func took 0.22196769714355 microseconds<br />
Output for 5.3.10
Func took 0.54597854614258 microseconds<br />
Output for 5.3.9
Func took 0.2751350402832 microseconds<br />
Output for 5.3.8
Func took 0.36406517028809 microseconds<br />
Output for 5.3.6
Func took 0.25105476379395 microseconds<br />
Output for 5.3.5
Func took 0.28085708618164 microseconds<br />
Output for 5.3.4
Func took 0.31304359436035 microseconds<br />
Output for 5.3.2
Func took 0.22292137145996 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/YAknS 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/YAknS 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/YAknS 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/YAknS on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/YAknS on line 13
Process exited with code 255.

preferences:
169.57 ms | 401 KiB | 232 Q