3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $classmap1 = array(); for ($i=1; $i<=10; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=10; $i++) { $classmap2['b'.$i] = $i+1; } $startTimeMerge = microtime(true); $map = array_merge($classmap1, $classmap2); $endTimeMerge = microtime(true); $startTimeForeach = microtime(true); foreach ($classmap2 as $k => $v) { $classmap1[$k] = $v; } $endTimeForeach = microtime(true); echo "Merging took " . (($endTimeMerge - $startTimeMerge)*1000) ." microseconds<br />\n"; echo "Foreach took " . (($endTimeForeach - $startTimeForeach)*1000) ." seconds<br />\n";
Output for 7.0.3, 7.1.0
Merging took 0.0019073486328125 microseconds<br /> Foreach took 0.0021457672119141 seconds<br />
Output for 7.0.0, 7.0.4, 7.0.14
Merging took 0.0021457672119141 microseconds<br /> Foreach took 0.0019073486328125 seconds<br />
Output for 7.0.2, 7.0.7
Merging took 0.0019073486328125 microseconds<br /> Foreach took 0.0030994415283203 seconds<br />
Output for 7.0.6
Merging took 0.00095367431640625 microseconds<br /> Foreach took 0.0019073486328125 seconds<br />
Output for 7.0.5
Merging took 0.0019073486328125 microseconds<br /> Foreach took 0.0019073486328125 seconds<br />
Output for 7.0.1
Merging took 0.0011920928955078 microseconds<br /> Foreach took 0.0019073486328125 seconds<br />
Output for 5.5.7, 5.5.19 - 5.5.20, 5.5.28, 5.5.31, 5.6.10, 5.6.12, 5.6.15, 5.6.28
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0069141387939453 seconds<br />
Output for 5.5.22, 5.5.35, 5.6.22
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0059604644775391 seconds<br />
Output for 5.5.12 - 5.5.13, 5.5.27, 5.5.33, 5.5.36, 5.6.6, 5.6.8, 5.6.18 - 5.6.19, 5.6.21
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0059604644775391 seconds<br />
Output for 5.6.20
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.003814697265625 seconds<br />
Output for 5.6.13, 5.6.17
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0069141387939453 seconds<br />
Output for 5.6.16
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0071525573730469 seconds<br />
Output for 5.6.14
Merging took 0.0028610229492188 microseconds<br /> Foreach took 0.0050067901611328 seconds<br />
Output for 5.5.8, 5.5.14, 5.5.21, 5.6.11
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0071525573730469 seconds<br />
Output for 5.5.9, 5.5.18, 5.6.1 - 5.6.2, 5.6.9
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0071525573730469 seconds<br />
Output for 5.5.6, 5.6.7
Merging took 0.0030994415283203 microseconds<br /> Foreach took 0.0050067901611328 seconds<br />
Output for 5.5.29, 5.5.34, 5.6.5
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0050067901611328 seconds<br />
Output for 5.6.4
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.010013580322266 seconds<br />
Output for 5.6.3
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0081062316894531 seconds<br />
Output for 5.5.30, 5.5.32, 5.6.0
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0069141387939453 seconds<br />
Output for 5.5.26
Merging took 0.003814697265625 microseconds<br /> Foreach took 0.0050067901611328 seconds<br />
Output for 5.5.25
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0061988830566406 seconds<br />
Output for 5.5.24
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.010967254638672 seconds<br />
Output for 5.5.23
Merging took 0.0061988830566406 microseconds<br /> Foreach took 0.0069141387939453 seconds<br />
Output for 5.5.16
Merging took 0.003814697265625 microseconds<br /> Foreach took 0.0040531158447266 seconds<br />
Output for 5.5.15
Merging took 0.0028610229492188 microseconds<br /> Foreach took 0.0040531158447266 seconds<br />
Output for 5.5.11
Merging took 0.0071525573730469 microseconds<br /> Foreach took 0.0088214874267578 seconds<br />
Output for 5.5.10
Merging took 0.0071525573730469 microseconds<br /> Foreach took 0.0090599060058594 seconds<br />
Output for 5.3.10, 5.3.15, 5.3.20 - 5.3.21, 5.4.17, 5.4.21, 5.5.2, 5.5.5
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0030994415283203 seconds<br />
Output for 5.4.22, 5.5.4
Merging took 0.0090599060058594 microseconds<br /> Foreach took 0.0028610229492188 seconds<br />
Output for 5.2.5 - 5.2.6, 5.2.16 - 5.2.17, 5.3.16 - 5.3.17, 5.3.28, 5.4.23, 5.5.3
Merging took 0.0069141387939453 microseconds<br /> Foreach took 0.0040531158447266 seconds<br />
Output for 5.3.26, 5.5.1
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0030994415283203 seconds<br />
Output for 5.3.22, 5.5.0
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0028610229492188 seconds<br />
Output for 5.4.28, 5.4.40, 5.4.43, 5.4.45
Merging took 0.0090599060058594 microseconds<br /> Foreach took 0.0050067901611328 seconds<br />
Output for 5.3.7, 5.4.6, 5.4.26, 5.4.44
Merging took 0.0078678131103516 microseconds<br /> Foreach took 0.0040531158447266 seconds<br />
Output for 5.2.4, 5.3.14, 5.4.15, 5.4.36, 5.4.39, 5.4.42
Merging took 0.0071525573730469 microseconds<br /> Foreach took 0.0040531158447266 seconds<br />
Output for 5.4.41
Merging took 0.014781951904297 microseconds<br /> Foreach took 0.0050067901611328 seconds<br />
Output for 5.3.11, 5.4.19, 5.4.38
Merging took 0.0078678131103516 microseconds<br /> Foreach took 0.0050067901611328 seconds<br />
Output for 5.1.0, 5.4.32, 5.4.37
Merging took 0.010013580322266 microseconds<br /> Foreach took 0.0059604644775391 seconds<br />
Output for 5.4.35
Merging took 0.010013580322266 microseconds<br /> Foreach took 0.0061988830566406 seconds<br />
Output for 5.4.34
Merging took 0.011920928955078 microseconds<br /> Foreach took 0.0069141387939453 seconds<br />
Output for 5.4.31
Merging took 0.0090599060058594 microseconds<br /> Foreach took 0.003814697265625 seconds<br />
Output for 5.4.30
Merging took 0.0097751617431641 microseconds<br /> Foreach took 0.0050067901611328 seconds<br />
Output for 5.2.2, 5.3.19, 5.4.11, 5.4.25, 5.4.27, 5.4.29
Merging took 0.010013580322266 microseconds<br /> Foreach took 0.0050067901611328 seconds<br />
Output for 5.4.24
Merging took 0.0090599060058594 microseconds<br /> Foreach took 0.0059604644775391 seconds<br />
Output for 5.3.9, 5.3.13, 5.3.23, 5.4.20
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0028610229492188 seconds<br />
Output for 5.3.8, 5.4.5, 5.4.18
Merging took 0.0071525573730469 microseconds<br /> Foreach took 0.0028610229492188 seconds<br />
Output for 5.4.16
Merging took 0.010967254638672 microseconds<br /> Foreach took 0.003814697265625 seconds<br />
Output for 5.2.0, 5.3.6, 5.3.12, 5.3.24, 5.4.14
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0040531158447266 seconds<br />
Output for 5.2.8, 5.4.1, 5.4.13
Merging took 0.0071525573730469 microseconds<br /> Foreach took 0.003814697265625 seconds<br />
Output for 5.2.10, 5.4.12
Merging took 0.0088214874267578 microseconds<br /> Foreach took 0.0050067901611328 seconds<br />
Output for 5.3.2 - 5.3.3, 5.4.10
Merging took 0.0081062316894531 microseconds<br /> Foreach took 0.0050067901611328 seconds<br />
Output for 5.4.9
Merging took 0.0090599060058594 microseconds<br /> Foreach took 0.0030994415283203 seconds<br />
Output for 5.4.8
Merging took 0.0078678131103516 microseconds<br /> Foreach took 0.0061988830566406 seconds<br />
Output for 5.4.7
Merging took 0.0078678131103516 microseconds<br /> Foreach took 0.0030994415283203 seconds<br />
Output for 5.4.0, 5.4.4
Merging took 0.0081062316894531 microseconds<br /> Foreach took 0.0040531158447266 seconds<br />
Output for 5.4.3
Merging took 0.013113021850586 microseconds<br /> Foreach took 0.0050067901611328 seconds<br />
Output for 5.4.2
Merging took 0.0097751617431641 microseconds<br /> Foreach took 0.0061988830566406 seconds<br />
Output for 5.2.13, 5.3.4, 5.3.29
Merging took 0.0078678131103516 microseconds<br /> Foreach took 0.003814697265625 seconds<br />
Output for 5.3.27
Merging took 0.0069141387939453 microseconds<br /> Foreach took 0.003814697265625 seconds<br />
Output for 5.3.25
Merging took 0.0088214874267578 microseconds<br /> Foreach took 0.003814697265625 seconds<br />
Output for 5.1.4, 5.3.18
Merging took 0.0090599060058594 microseconds<br /> Foreach took 0.0040531158447266 seconds<br />
Output for 5.2.9, 5.2.14 - 5.2.15, 5.3.5
Merging took 0.0069141387939453 microseconds<br /> Foreach took 0.0030994415283203 seconds<br />
Output for 5.2.3, 5.3.1
Merging took 0.0061988830566406 microseconds<br /> Foreach took 0.0028610229492188 seconds<br />
Output for 5.3.0
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0050067901611328 seconds<br />
Output for 5.2.12
Merging took 0.010967254638672 microseconds<br /> Foreach took 0.0050067901611328 seconds<br />
Output for 5.2.11
Merging took 0.0088214874267578 microseconds<br /> Foreach took 0.0059604644775391 seconds<br />
Output for 5.2.7
Merging took 0.011920928955078 microseconds<br /> Foreach took 0.003814697265625 seconds<br />
Output for 5.2.1
Merging took 0.0081062316894531 microseconds<br /> Foreach took 0.0059604644775391 seconds<br />
Output for 5.1.6
Merging took 0.011920928955078 microseconds<br /> Foreach took 0.0040531158447266 seconds<br />
Output for 5.1.5
Merging took 0.010013580322266 microseconds<br /> Foreach took 0.0040531158447266 seconds<br />
Output for 5.1.3
Merging took 0.0088214874267578 microseconds<br /> Foreach took 0.0030994415283203 seconds<br />
Output for 5.1.2
Merging took 0.012874603271484 microseconds<br /> Foreach took 0.0061988830566406 seconds<br />
Output for 5.1.1
Merging took 0.013113021850586 microseconds<br /> Foreach took 0.0069141387939453 seconds<br />
Output for 5.0.5
Merging took 0.014066696166992 microseconds<br /> Foreach took 0.01215934753418 seconds<br />
Output for 5.0.4
Merging took 0.012874603271484 microseconds<br /> Foreach took 0.01215934753418 seconds<br />
Output for 5.0.3
Merging took 0.013113021850586 microseconds<br /> Foreach took 0.013113021850586 seconds<br />
Output for 5.0.2
Merging took 0.012874603271484 microseconds<br /> Foreach took 0.011920928955078 seconds<br />
Output for 5.0.1
Merging took 0.013828277587891 microseconds<br /> Foreach took 0.012874603271484 seconds<br />
Output for 5.0.0
Merging took 0.014066696166992 microseconds<br /> Foreach took 0.010967254638672 seconds<br />
Output for 4.4.5, 4.4.9
Merging took 0.014 microseconds<br /> Foreach took 0.007 seconds<br />
Output for 4.4.8
Merging took 0.017 microseconds<br /> Foreach took 0.011 seconds<br />
Output for 4.4.7
Merging took 0.011 microseconds<br /> Foreach took 0.007 seconds<br />
Output for 4.4.6
Merging took 0.015 microseconds<br /> Foreach took 0.006 seconds<br />
Output for 4.4.4
Merging took 0.013 microseconds<br /> Foreach took 0.007 seconds<br />
Output for 4.4.3
Merging took 0.012 microseconds<br /> Foreach took 0.006 seconds<br />
Output for 4.4.2
Merging took 0.024 microseconds<br /> Foreach took 0.012 seconds<br />
Output for 4.4.1
Merging took 0.026 microseconds<br /> Foreach took 0.015 seconds<br />
Output for 4.4.0
Merging took 0.02 microseconds<br /> Foreach took 0.011 seconds<br />
Output for 4.3.11
Merging took 0.02 microseconds<br /> Foreach took 0.013 seconds<br />
Output for 4.3.10
Merging took 0.024 microseconds<br /> Foreach took 0.013 seconds<br />
Output for 4.3.9
Merging took 0.021 microseconds<br /> Foreach took 0.014 seconds<br />
Output for 4.3.4, 4.3.7 - 4.3.8
Merging took 0.018 microseconds<br /> Foreach took 0.012 seconds<br />
Output for 4.3.6
Merging took 0.022 microseconds<br /> Foreach took 0.014 seconds<br />
Output for 4.3.5
Merging took 0.021 microseconds<br /> Foreach took 0.013 seconds<br />
Output for 4.3.3
Merging took 0.018 microseconds<br /> Foreach took 0.013 seconds<br />
Output for 4.3.2
Merging took 0.023 microseconds<br /> Foreach took 0.013 seconds<br />
Output for 4.3.1
Merging took 0.017 microseconds<br /> Foreach took 0.01 seconds<br />
Output for 4.3.0
Merging took 0.016 microseconds<br /> Foreach took 0.01 seconds<br />