3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=1000; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=1000; $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.3.12
Func took 0.15497207641602 microseconds<br />
Output for 7.3.6, 7.3.11
Func took 0.15401840209961 microseconds<br />
Output for 7.3.10
Func took 0.20313262939453 microseconds<br />
Output for 7.3.9
Func took 0.35595893859863 microseconds<br />
Output for 7.3.8
Func took 0.31685829162598 microseconds<br />
Output for 7.1.25, 7.1.30, 7.3.7
Func took 0.15902519226074 microseconds<br />
Output for 7.3.5
Func took 0.19288063049316 microseconds<br />
Output for 7.1.28, 7.3.4
Func took 0.16283988952637 microseconds<br />
Output for 7.2.24, 7.3.3
Func took 0.16093254089355 microseconds<br />
Output for 7.3.2
Func took 0.10418891906738 microseconds<br />
Output for 7.3.1
Func took 0.1988410949707 microseconds<br />
Output for 7.3.0
Func took 0.13303756713867 microseconds<br />
Output for 7.2.23
Func took 0.2448558807373 microseconds<br />
Output for 7.2.22
Func took 0.15711784362793 microseconds<br />
Output for 7.2.21
Func took 0.26106834411621 microseconds<br />
Output for 7.2.20
Func took 0.15807151794434 microseconds<br />
Output for 7.1.26, 7.2.19
Func took 0.16593933105469 microseconds<br />
Output for 7.2.18
Func took 0.26202201843262 microseconds<br />
Output for 7.2.17
Func took 0.28204917907715 microseconds<br />
Output for 7.2.16
Func took 0.15997886657715 microseconds<br />
Output for 7.2.15
Func took 0.11014938354492 microseconds<br />
Output for 7.2.3, 7.2.13 - 7.2.14
Func took 0.11205673217773 microseconds<br />
Output for 7.0.1, 7.0.6, 7.2.12
Func took 0.10800361633301 microseconds<br />
Output for 7.2.11
Func took 0.12302398681641 microseconds<br />
Output for 7.2.10
Func took 0.1680850982666 microseconds<br />
Output for 7.2.9
Func took 0.17690658569336 microseconds<br />
Output for 7.2.8
Func took 0.11587142944336 microseconds<br />
Output for 7.2.7
Func took 0.22292137145996 microseconds<br />
Output for 7.0.0, 7.2.6
Func took 0.11396408081055 microseconds<br />
Output for 7.2.5
Func took 0.16689300537109 microseconds<br />
Output for 7.0.3, 7.2.4
Func took 0.10895729064941 microseconds<br />
Output for 7.1.5, 7.2.2
Func took 0.11301040649414 microseconds<br />
Output for 7.2.1
Func took 0.17786026000977 microseconds<br />
Output for 7.2.0
Func took 0.2140998840332 microseconds<br />
Output for 7.1.33
Func took 0.16212463378906 microseconds<br />
Output for 7.1.32
Func took 0.2129077911377 microseconds<br />
Output for 7.1.31
Func took 0.42605400085449 microseconds<br />
Output for 7.1.29
Func took 0.20909309387207 microseconds<br />
Output for 7.1.27
Func took 0.2598762512207 microseconds<br />
Output for 7.1.7
Func took 0.072002410888672 microseconds<br />
Output for 7.1.6
Func took 0.18095970153809 microseconds<br />
Output for 7.1.0
Func took 0.094175338745117 microseconds<br />
Output for 7.0.20
Func took 0.097990036010742 microseconds<br />
Output for 7.0.14
Func took 0.12087821960449 microseconds<br />
Output for 7.0.11
Func took 0.11897087097168 microseconds<br />
Output for 7.0.10
Func took 0.1218318939209 microseconds<br />
Output for 7.0.9
Func took 0.11706352233887 microseconds<br />
Output for 7.0.8
Func took 0.14114379882812 microseconds<br />
Output for 7.0.7
Func took 0.1220703125 microseconds<br />
Output for 7.0.5
Func took 0.095844268798828 microseconds<br />
Output for 7.0.4
Func took 0.13899803161621 microseconds<br />
Output for 7.0.2
Func took 0.11801719665527 microseconds<br />
Output for 5.6.28
Func took 0.65398216247559 microseconds<br />
Output for 5.6.26
Func took 0.44798851013184 microseconds<br />
Output for 5.6.25
Func took 0.64778327941895 microseconds<br />
Output for 5.6.24
Func took 0.74100494384766 microseconds<br />
Output for 5.6.23
Func took 0.42200088500977 microseconds<br />
Output for 5.6.22
Func took 0.56099891662598 microseconds<br />
Output for 5.6.21
Func took 0.67615509033203 microseconds<br />
Output for 5.6.20
Func took 0.63896179199219 microseconds<br />
Output for 5.6.19
Func took 0.68902969360352 microseconds<br />
Output for 5.6.18
Func took 0.53787231445312 microseconds<br />
Output for 5.6.17
Func took 0.52094459533691 microseconds<br />
Output for 5.4.10, 5.6.16
Func took 0.72288513183594 microseconds<br />
Output for 5.6.15
Func took 0.62203407287598 microseconds<br />
Output for 5.6.14
Func took 0.52499771118164 microseconds<br />
Output for 5.6.13
Func took 0.61917304992676 microseconds<br />
Output for 5.6.12
Func took 0.61702728271484 microseconds<br />
Output for 5.6.10 - 5.6.11
Func took 0.59390068054199 microseconds<br />
Output for 5.6.9
Func took 0.70285797119141 microseconds<br />
Output for 5.6.8
Func took 0.68283081054688 microseconds<br />
Output for 5.3.2, 5.6.7
Func took 0.66709518432617 microseconds<br />
Output for 5.6.6
Func took 0.68402290344238 microseconds<br />
Output for 5.6.5
Func took 0.51593780517578 microseconds<br />
Output for 5.6.4
Func took 0.54597854614258 microseconds<br />
Output for 5.6.3
Func took 0.41604042053223 microseconds<br />
Output for 5.6.2
Func took 0.42486190795898 microseconds<br />
Output for 5.4.13, 5.4.24, 5.6.1
Func took 0.60701370239258 microseconds<br />
Output for 5.6.0
Func took 0.52905082702637 microseconds<br />
Output for 5.5.38
Func took 0.66614151000977 microseconds<br />
Output for 5.4.30, 5.5.37
Func took 0.4417896270752 microseconds<br />
Output for 5.5.10, 5.5.36
Func took 0.76103210449219 microseconds<br />
Output for 5.5.29, 5.5.35
Func took 0.63800811767578 microseconds<br />
Output for 5.5.34
Func took 0.67901611328125 microseconds<br />
Output for 5.4.8, 5.5.33
Func took 0.67400932312012 microseconds<br />
Output for 5.5.32
Func took 0.60486793518066 microseconds<br />
Output for 5.4.16, 5.5.31
Func took 0.59008598327637 microseconds<br />
Output for 5.5.18, 5.5.30
Func took 0.73385238647461 microseconds<br />
Output for 5.5.28
Func took 0.64206123352051 microseconds<br />
Output for 5.5.27
Func took 1.0550022125244 microseconds<br />
Output for 5.5.26
Func took 0.62799453735352 microseconds<br />
Output for 5.5.25
Func took 0.83589553833008 microseconds<br />
Output for 5.5.24
Func took 0.64587593078613 microseconds<br />
Output for 5.5.23
Func took 0.64301490783691 microseconds<br />
Output for 5.5.22
Func took 0.70381164550781 microseconds<br />
Output for 5.5.21
Func took 0.75411796569824 microseconds<br />
Output for 5.5.20
Func took 0.56910514831543 microseconds<br />
Output for 5.5.19
Func took 0.6110668182373 microseconds<br />
Output for 5.4.23, 5.4.25, 5.5.16
Func took 0.66494941711426 microseconds<br />
Output for 5.5.15
Func took 0.67687034606934 microseconds<br />
Output for 5.4.9, 5.5.14
Func took 0.69689750671387 microseconds<br />
Output for 5.5.13
Func took 0.59080123901367 microseconds<br />
Output for 5.5.12
Func took 0.55909156799316 microseconds<br />
Output for 5.5.11
Func took 0.69189071655273 microseconds<br />
Output for 5.5.9
Func took 0.68306922912598 microseconds<br />
Output for 5.5.8
Func took 0.54502487182617 microseconds<br />
Output for 5.5.7
Func took 0.55694580078125 microseconds<br />
Output for 5.5.6
Func took 0.70500373840332 microseconds<br />
Output for 5.4.42, 5.5.5
Func took 0.73695182800293 microseconds<br />
Output for 5.5.4
Func took 0.66399574279785 microseconds<br />
Output for 5.5.3
Func took 0.62990188598633 microseconds<br />
Output for 5.5.2
Func took 0.50592422485352 microseconds<br />
Output for 5.5.1
Func took 0.57387351989746 microseconds<br />
Output for 5.3.12, 5.5.0
Func took 0.66304206848145 microseconds<br />
Output for 5.4.45
Func took 0.68092346191406 microseconds<br />
Output for 5.4.44
Func took 0.71215629577637 microseconds<br />
Output for 5.4.43
Func took 0.70810317993164 microseconds<br />
Output for 5.4.41
Func took 0.69594383239746 microseconds<br />
Output for 5.3.7, 5.4.40
Func took 0.67496299743652 microseconds<br />
Output for 5.4.39
Func took 0.72598457336426 microseconds<br />
Output for 5.4.38
Func took 0.64897537231445 microseconds<br />
Output for 5.4.37
Func took 0.6868839263916 microseconds<br />
Output for 5.4.36
Func took 0.65279006958008 microseconds<br />
Output for 5.4.17, 5.4.35
Func took 0.6721019744873 microseconds<br />
Output for 5.4.34
Func took 0.72908401489258 microseconds<br />
Output for 5.4.32
Func took 0.56314468383789 microseconds<br />
Output for 5.4.31
Func took 0.7631778717041 microseconds<br />
Output for 5.4.29
Func took 0.65803527832031 microseconds<br />
Output for 5.4.28
Func took 0.56290626525879 microseconds<br />
Output for 5.4.27
Func took 0.72407722473145 microseconds<br />
Output for 5.4.26
Func took 0.58817863464355 microseconds<br />
Output for 5.4.22
Func took 0.64706802368164 microseconds<br />
Output for 5.4.21
Func took 0.69379806518555 microseconds<br />
Output for 5.4.20
Func took 0.66900253295898 microseconds<br />
Output for 5.4.19
Func took 0.61178207397461 microseconds<br />
Output for 5.4.18
Func took 0.6101131439209 microseconds<br />
Output for 5.4.15
Func took 0.69499015808105 microseconds<br />
Output for 5.4.14
Func took 0.58698654174805 microseconds<br />
Output for 5.4.12
Func took 0.58412551879883 microseconds<br />
Output for 5.4.11
Func took 0.73099136352539 microseconds<br />
Output for 5.4.7
Func took 0.64420700073242 microseconds<br />
Output for 5.4.6
Func took 0.74195861816406 microseconds<br />
Output for 5.4.5
Func took 0.63204765319824 microseconds<br />
Output for 5.4.4
Func took 0.66804885864258 microseconds<br />
Output for 5.4.3
Func took 0.72503089904785 microseconds<br />
Output for 5.4.2
Func took 0.71096420288086 microseconds<br />
Output for 5.4.1
Func took 0.66089630126953 microseconds<br />
Output for 5.4.0
Func took 0.74219703674316 microseconds<br />
Output for 5.3.29
Func took 0.55098533630371 microseconds<br />
Output for 5.3.28
Func took 0.78392028808594 microseconds<br />
Output for 5.3.27
Func took 0.71001052856445 microseconds<br />
Output for 5.3.26
Func took 0.75197219848633 microseconds<br />
Output for 5.3.25
Func took 0.73909759521484 microseconds<br />
Output for 5.3.24
Func took 0.69117546081543 microseconds<br />
Output for 5.3.23
Func took 0.5180835723877 microseconds<br />
Output for 5.3.22
Func took 0.73003768920898 microseconds<br />
Output for 5.3.21
Func took 0.77700614929199 microseconds<br />
Output for 5.3.20
Func took 0.66113471984863 microseconds<br />
Output for 5.3.19
Func took 0.67710876464844 microseconds<br />
Output for 5.3.18
Func took 0.69904327392578 microseconds<br />
Output for 5.3.17
Func took 0.65994262695312 microseconds<br />
Output for 5.3.16
Func took 0.68998336791992 microseconds<br />
Output for 5.3.15
Func took 0.69808959960938 microseconds<br />
Output for 5.3.14
Func took 0.7789134979248 microseconds<br />
Output for 5.3.13
Func took 0.78511238098145 microseconds<br />
Output for 5.3.11
Func took 0.73814392089844 microseconds<br />
Output for 5.3.10
Func took 0.58484077453613 microseconds<br />
Output for 5.3.9
Func took 0.8389949798584 microseconds<br />
Output for 5.3.8
Func took 0.70691108703613 microseconds<br />
Output for 5.3.6
Func took 0.75483322143555 microseconds<br />
Output for 5.3.5
Func took 0.61511993408203 microseconds<br />
Output for 5.3.4
Func took 0.73409080505371 microseconds<br />
Output for 5.3.3
Func took 0.76508522033691 microseconds<br />
Output for 5.3.1
Func took 0.67782402038574 microseconds<br />
Output for 5.3.0
Func took 0.81682205200195 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/a6DFD 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/a6DFD 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/a6DFD 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/a6DFD on line 13
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/a6DFD on line 13
Process exited with code 255.

preferences:
193.5 ms | 401 KiB | 264 Q