3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 (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.03814697265625 microseconds<br />
Output for 7.0.14
Func took 0.055074691772461 microseconds<br />
Output for 7.0.10
Func took 0.065088272094727 microseconds<br />
Output for 7.0.9
Func took 0.069856643676758 microseconds<br />
Output for 7.0.8
Func took 0.077962875366211 microseconds<br />
Output for 7.0.7
Func took 0.05793571472168 microseconds<br />
Output for 7.0.6
Func took 0.063896179199219 microseconds<br />
Output for 7.0.5
Func took 0.06103515625 microseconds<br />
Output for 7.0.0, 7.0.4
Func took 0.054121017456055 microseconds<br />
Output for 7.0.1, 7.0.3
Func took 0.052928924560547 microseconds<br />
Output for 7.0.2
Func took 0.051021575927734 microseconds<br />
Output for hhvm-3.12.0
Func took 0.11110305786133 microseconds<br />
Output for hhvm-3.10.0
Func took 0.13899803161621 microseconds<br />
Output for 5.6.20, 5.6.28
Func took 0.27203559875488 microseconds<br />
Output for 5.4.44, 5.5.8, 5.6.25
Func took 0.27799606323242 microseconds<br />
Output for 5.6.24
Func took 0.2129077911377 microseconds<br />
Output for 5.6.23
Func took 0.18811225891113 microseconds<br />
Output for 5.4.5, 5.6.22
Func took 0.23198127746582 microseconds<br />
Output for 5.6.21
Func took 0.25415420532227 microseconds<br />
Output for 5.5.2, 5.6.19
Func took 0.24986267089844 microseconds<br />
Output for 5.6.18
Func took 0.28681755065918 microseconds<br />
Output for 5.5.12, 5.5.36, 5.6.17
Func took 0.21791458129883 microseconds<br />
Output for 5.6.16
Func took 0.45418739318848 microseconds<br />
Output for 5.6.15
Func took 0.24604797363281 microseconds<br />
Output for 5.6.14
Func took 0.20694732666016 microseconds<br />
Output for 5.6.11, 5.6.13
Func took 0.28300285339355 microseconds<br />
Output for 5.6.12
Func took 0.29301643371582 microseconds<br />
Output for 5.6.10
Func took 0.25701522827148 microseconds<br />
Output for 5.6.9
Func took 0.19216537475586 microseconds<br />
Output for 5.6.1, 5.6.8
Func took 0.26702880859375 microseconds<br />
Output for 5.6.7
Func took 0.27894973754883 microseconds<br />
Output for 5.6.6
Func took 0.26917457580566 microseconds<br />
Output for 5.6.5
Func took 0.25796890258789 microseconds<br />
Output for 5.6.4
Func took 0.23698806762695 microseconds<br />
Output for 5.6.3
Func took 0.2739429473877 microseconds<br />
Output for 5.6.2
Func took 0.27704238891602 microseconds<br />
Output for 5.3.1, 5.6.0
Func took 0.17189979553223 microseconds<br />
Output for 5.5.38
Func took 0.29802322387695 microseconds<br />
Output for 5.5.37
Func took 0.21481513977051 microseconds<br />
Output for 5.5.35
Func took 0.26607513427734 microseconds<br />
Output for 5.5.6, 5.5.34
Func took 0.28800964355469 microseconds<br />
Output for 5.5.33
Func took 0.29993057250977 microseconds<br />
Output for 5.4.37, 5.5.3, 5.5.10, 5.5.19, 5.5.32
Func took 0.24700164794922 microseconds<br />
Output for 5.5.31
Func took 0.37193298339844 microseconds<br />
Output for 5.5.30
Func took 0.33402442932129 microseconds<br />
Output for 5.5.29
Func took 0.3969669342041 microseconds<br />
Output for 5.4.17, 5.5.28
Func took 0.23603439331055 microseconds<br />
Output for 5.5.27
Func took 0.32186508178711 microseconds<br />
Output for 5.5.26
Func took 0.41007995605469 microseconds<br />
Output for 5.3.26, 5.5.25
Func took 0.23889541625977 microseconds<br />
Output for 5.4.38, 5.5.24
Func took 0.27990341186523 microseconds<br />
Output for 5.5.23
Func took 0.26798248291016 microseconds<br />
Output for 5.5.22
Func took 0.2291202545166 microseconds<br />
Output for 5.5.21
Func took 0.27322769165039 microseconds<br />
Output for 5.5.20
Func took 0.19001960754395 microseconds<br />
Output for 5.5.18
Func took 0.22101402282715 microseconds<br />
Output for 5.5.16
Func took 0.30422210693359 microseconds<br />
Output for 5.5.15
Func took 0.28395652770996 microseconds<br />
Output for 5.5.14
Func took 0.32401084899902 microseconds<br />
Output for 5.5.13
Func took 0.33307075500488 microseconds<br />
Output for 5.4.31, 5.5.11
Func took 0.2140998840332 microseconds<br />
Output for 5.4.40, 5.5.9
Func took 0.30088424682617 microseconds<br />
Output for 5.5.7
Func took 0.28109550476074 microseconds<br />
Output for 5.4.42, 5.5.5
Func took 0.28610229492188 microseconds<br />
Output for 5.5.4
Func took 0.23412704467773 microseconds<br />
Output for 5.5.1
Func took 0.29206275939941 microseconds<br />
Output for 5.4.25, 5.5.0
Func took 0.18215179443359 microseconds<br />
Output for 5.4.45
Func took 0.20003318786621 microseconds<br />
Output for 5.4.43
Func took 0.19502639770508 microseconds<br />
Output for 5.4.36, 5.4.41
Func took 0.21886825561523 microseconds<br />
Output for 5.4.39
Func took 0.26178359985352 microseconds<br />
Output for 5.4.35
Func took 0.26202201843262 microseconds<br />
Output for 5.4.34
Func took 0.34499168395996 microseconds<br />
Output for 5.4.32
Func took 0.29706954956055 microseconds<br />
Output for 5.4.30
Func took 0.25105476379395 microseconds<br />
Output for 5.4.29
Func took 0.33998489379883 microseconds<br />
Output for 5.4.28
Func took 0.28491020202637 microseconds<br />
Output for 5.4.27
Func took 0.24294853210449 microseconds<br />
Output for 5.4.26
Func took 0.28419494628906 microseconds<br />
Output for 5.4.24
Func took 0.24890899658203 microseconds<br />
Output for 5.4.23
Func took 0.18715858459473 microseconds<br />
Output for 5.3.23, 5.4.22
Func took 0.22697448730469 microseconds<br />
Output for 5.4.21
Func took 0.25510787963867 microseconds<br />
Output for 5.4.20
Func took 0.26297569274902 microseconds<br />
Output for 5.4.19
Func took 0.25296211242676 microseconds<br />
Output for 5.4.18
Func took 0.24199485778809 microseconds<br />
Output for 5.4.16
Func took 0.19383430480957 microseconds<br />
Output for 5.3.20, 5.4.15
Func took 0.17595291137695 microseconds<br />
Output for 5.4.14
Func took 0.17404556274414 microseconds<br />
Output for 5.4.13
Func took 0.23293495178223 microseconds<br />
Output for 5.4.12
Func took 0.17309188842773 microseconds<br />
Output for 5.3.7 - 5.3.8, 5.3.11, 5.4.11
Func took 0.16903877258301 microseconds<br />
Output for 5.4.10
Func took 0.16307830810547 microseconds<br />
Output for 5.4.9
Func took 0.18596649169922 microseconds<br />
Output for 5.4.8
Func took 0.17809867858887 microseconds<br />
Output for 5.3.10, 5.3.15, 5.3.19, 5.4.0 - 5.4.1, 5.4.7
Func took 0.16498565673828 microseconds<br />
Output for 5.4.6
Func took 0.16403198242188 microseconds<br />
Output for 5.4.4
Func took 0.22506713867188 microseconds<br />
Output for 5.4.3
Func took 0.20599365234375 microseconds<br />
Output for 5.4.2
Func took 0.16689300537109 microseconds<br />
Output for 5.3.29
Func took 0.30612945556641 microseconds<br />
Output for 5.3.28
Func took 0.2589225769043 microseconds<br />
Output for 5.3.27
Func took 0.30183792114258 microseconds<br />
Output for 5.3.25
Func took 0.1678466796875 microseconds<br />
Output for 5.3.24
Func took 0.17094612121582 microseconds<br />
Output for 5.3.22
Func took 0.17786026000977 microseconds<br />
Output for 5.3.2, 5.3.21
Func took 0.17499923706055 microseconds<br />
Output for 5.3.18
Func took 0.16593933105469 microseconds<br />
Output for 5.3.17
Func took 0.1528263092041 microseconds<br />
Output for 5.3.14, 5.3.16
Func took 0.1680850982666 microseconds<br />
Output for 5.3.13
Func took 0.17905235290527 microseconds<br />
Output for 5.3.12
Func took 0.16617774963379 microseconds<br />
Output for 5.3.9
Func took 0.14400482177734 microseconds<br />
Output for 5.3.6
Func took 0.17213821411133 microseconds<br />
Output for 5.3.5
Func took 0.23102760314941 microseconds<br />
Output for 5.3.4
Func took 0.21219253540039 microseconds<br />
Output for 5.3.3
Func took 0.22411346435547 microseconds<br />
Output for 5.3.0
Func took 0.18882751464844 microseconds<br />
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_STATIC in /in/thFHi 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/thFHi 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/thFHi 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/thFHi on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/thFHi on line 13
Process exited with code 255.