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) ." seconds<br />\n"; echo "Foreach took " . ($endTimeForeach - $startTimeForeach) ." seconds<br />\n";
Output for 7.0.5, 7.1.0
Merging took 1.9073486328125E-6 seconds<br /> Foreach took 2.1457672119141E-6 seconds<br />
Output for 7.0.12 - 7.0.14
Merging took 2.1457672119141E-6 seconds<br /> Foreach took 2.8610229492188E-6 seconds<br />
Output for 7.0.4, 7.0.6
Merging took 1.9073486328125E-6 seconds<br /> Foreach took 3.0994415283203E-6 seconds<br />
Output for 7.0.0, 7.0.3
Merging took 2.1457672119141E-6 seconds<br /> Foreach took 1.9073486328125E-6 seconds<br />
Output for 7.0.2
Merging took 1.9073486328125E-6 seconds<br /> Foreach took 9.5367431640625E-7 seconds<br />
Output for 7.0.1
Merging took 1.1920928955078E-6 seconds<br /> Foreach took 9.5367431640625E-7 seconds<br />
Output for 5.6.21
Merging took 5.0067901611328E-6 seconds<br /> Foreach took 8.1062316894531E-6 seconds<br />
Output for 5.6.20
Merging took 4.7683715820312E-6 seconds<br /> Foreach took 7.1525573730469E-6 seconds<br />
Output for 5.5.27, 5.5.29, 5.5.31, 5.6.14, 5.6.16, 5.6.19
Merging took 5.0067901611328E-6 seconds<br /> Foreach took 5.9604644775391E-6 seconds<br />
Output for 5.5.28, 5.6.17 - 5.6.18
Merging took 4.0531158447266E-6 seconds<br /> Foreach took 5.0067901611328E-6 seconds<br />
Output for 5.6.10 - 5.6.11, 5.6.15
Merging took 4.0531158447266E-6 seconds<br /> Foreach took 5.9604644775391E-6 seconds<br />
Output for 5.6.7, 5.6.13
Merging took 5.0067901611328E-6 seconds<br /> Foreach took 6.1988830566406E-6 seconds<br />
Output for 5.5.25, 5.6.12
Merging took 5.9604644775391E-6 seconds<br /> Foreach took 5.9604644775391E-6 seconds<br />
Output for 5.6.9
Merging took 5.0067901611328E-6 seconds<br /> Foreach took 7.1525573730469E-6 seconds<br />
Output for 5.6.8
Merging took 5.9604644775391E-6 seconds<br /> Foreach took 7.1525573730469E-6 seconds<br />
Output for 5.5.35
Merging took 3.814697265625E-6 seconds<br /> Foreach took 4.0531158447266E-6 seconds<br />
Output for 5.5.24, 5.5.34
Merging took 5.9604644775391E-6 seconds<br /> Foreach took 6.9141387939453E-6 seconds<br />
Output for 5.5.33
Merging took 4.0531158447266E-6 seconds<br /> Foreach took 6.1988830566406E-6 seconds<br />
Output for 5.5.32
Merging took 4.0531158447266E-6 seconds<br /> Foreach took 8.1062316894531E-6 seconds<br />
Output for 5.5.30
Merging took 2.8610229492188E-6 seconds<br /> Foreach took 3.814697265625E-6 seconds<br />
Output for 5.5.26
Merging took 3.0994415283203E-6 seconds<br /> Foreach took 4.0531158447266E-6 seconds<br />
Output for 5.3.24, 5.4.21, 5.4.44 - 5.4.45
Merging took 7.1525573730469E-6 seconds<br /> Foreach took 4.0531158447266E-6 seconds<br />
Output for 5.2.8, 5.4.9, 5.4.43
Merging took 8.1062316894531E-6 seconds<br /> Foreach took 3.814697265625E-6 seconds<br />
Output for 5.2.13, 5.2.16, 5.3.18, 5.4.42
Merging took 7.1525573730469E-6 seconds<br /> Foreach took 5.0067901611328E-6 seconds<br />
Output for 5.4.41
Merging took 7.8678131103516E-6 seconds<br /> Foreach took 3.814697265625E-6 seconds<br />
Output for 5.4.10, 5.4.37, 5.4.40
Merging took 6.9141387939453E-6 seconds<br /> Foreach took 4.0531158447266E-6 seconds<br />
Output for 5.3.22 - 5.3.23, 5.4.16, 5.4.39
Merging took 7.8678131103516E-6 seconds<br /> Foreach took 5.0067901611328E-6 seconds<br />
Output for 5.3.5, 5.4.38
Merging took 5.9604644775391E-6 seconds<br /> Foreach took 5.0067901611328E-6 seconds<br />
Output for 5.4.31, 5.4.36
Merging took 6.1988830566406E-6 seconds<br /> Foreach took 3.814697265625E-6 seconds<br />
Output for 5.3.11, 5.3.19, 5.4.19, 5.4.35
Merging took 5.9604644775391E-6 seconds<br /> Foreach took 4.0531158447266E-6 seconds<br />
Output for 5.3.16, 5.3.21, 5.3.28, 5.4.20, 5.4.25, 5.4.34
Merging took 8.1062316894531E-6 seconds<br /> Foreach took 5.0067901611328E-6 seconds<br />
Output for 5.2.7, 5.2.10, 5.3.9, 5.3.20, 5.3.25 - 5.3.26, 5.4.12 - 5.4.14, 5.4.18, 5.4.32
Merging took 9.0599060058594E-6 seconds<br /> Foreach took 5.0067901611328E-6 seconds<br />
Output for 5.3.14, 5.3.27, 5.4.0, 5.4.2, 5.4.22, 5.4.30
Merging took 1.0013580322266E-5 seconds<br /> Foreach took 5.0067901611328E-6 seconds<br />
Output for 5.2.9, 5.3.10, 5.4.29
Merging took 8.1062316894531E-6 seconds<br /> Foreach took 4.0531158447266E-6 seconds<br />
Output for 5.3.13, 5.4.23, 5.4.28
Merging took 5.9604644775391E-6 seconds<br /> Foreach took 3.0994415283203E-6 seconds<br />
Output for 5.4.27
Merging took 9.0599060058594E-6 seconds<br /> Foreach took 5.9604644775391E-6 seconds<br />
Output for 5.3.29, 5.4.4, 5.4.26
Merging took 8.8214874267578E-6 seconds<br /> Foreach took 5.0067901611328E-6 seconds<br />
Output for 5.4.24
Merging took 7.8678131103516E-6 seconds<br /> Foreach took 4.0531158447266E-6 seconds<br />
Output for 5.3.2, 5.4.17
Merging took 8.8214874267578E-6 seconds<br /> Foreach took 6.1988830566406E-6 seconds<br />
Output for 5.4.15
Merging took 8.1062316894531E-6 seconds<br /> Foreach took 5.9604644775391E-6 seconds<br />
Output for 5.4.11
Merging took 5.9604644775391E-6 seconds<br /> Foreach took 3.814697265625E-6 seconds<br />
Output for 5.4.8
Merging took 1.3113021850586E-5 seconds<br /> Foreach took 5.0067901611328E-6 seconds<br />
Output for 5.2.6, 5.4.1, 5.4.7
Merging took 1.0967254638672E-5 seconds<br /> Foreach took 5.0067901611328E-6 seconds<br />
Output for 5.4.6
Merging took 8.8214874267578E-6 seconds<br /> Foreach took 3.814697265625E-6 seconds<br />
Output for 5.3.8, 5.4.5
Merging took 1.1205673217773E-5 seconds<br /> Foreach took 5.9604644775391E-6 seconds<br />
Output for 5.4.3
Merging took 1.0967254638672E-5 seconds<br /> Foreach took 5.9604644775391E-6 seconds<br />
Output for 5.3.17
Merging took 8.8214874267578E-6 seconds<br /> Foreach took 5.9604644775391E-6 seconds<br />
Output for 5.3.15
Merging took 7.8678131103516E-6 seconds<br /> Foreach took 4.7683715820312E-6 seconds<br />
Output for 5.3.12
Merging took 9.0599060058594E-6 seconds<br /> Foreach took 4.0531158447266E-6 seconds<br />
Output for 5.3.7
Merging took 8.8214874267578E-6 seconds<br /> Foreach took 4.0531158447266E-6 seconds<br />
Output for 5.3.6
Merging took 2.288818359375E-5 seconds<br /> Foreach took 4.0531158447266E-6 seconds<br />
Output for 5.3.4
Merging took 9.0599060058594E-6 seconds<br /> Foreach took 6.9141387939453E-6 seconds<br />
Output for 5.3.3
Merging took 5.0067901611328E-6 seconds<br /> Foreach took 3.0994415283203E-6 seconds<br />
Output for 5.3.1
Merging took 6.9141387939453E-6 seconds<br /> Foreach took 3.814697265625E-6 seconds<br />
Output for 5.3.0
Merging took 5.9604644775391E-6 seconds<br /> Foreach took 6.1988830566406E-6 seconds<br />
Output for 5.2.12, 5.2.15, 5.2.17
Merging took 6.9141387939453E-6 seconds<br /> Foreach took 5.0067901611328E-6 seconds<br />
Output for 5.2.14
Merging took 1.0013580322266E-5 seconds<br /> Foreach took 8.1062316894531E-6 seconds<br />
Output for 5.2.3, 5.2.11
Merging took 1.0013580322266E-5 seconds<br /> Foreach took 5.9604644775391E-6 seconds<br />
Output for 5.2.5
Merging took 1.1920928955078E-5 seconds<br /> Foreach took 6.1988830566406E-6 seconds<br />
Output for 5.2.4
Merging took 1.2874603271484E-5 seconds<br /> Foreach took 6.1988830566406E-6 seconds<br />
Output for 5.2.2
Merging took 1.0967254638672E-5 seconds<br /> Foreach took 6.1988830566406E-6 seconds<br />
Output for 5.2.1
Merging took 7.8678131103516E-06 seconds<br /> Foreach took 5.0067901611328E-06 seconds<br />
Output for 5.2.0
Merging took 8.1062316894531E-06 seconds<br /> Foreach took 5.9604644775391E-06 seconds<br />
Output for 5.1.6
Merging took 8.1062316894531E-06 seconds<br /> Foreach took 5.0067901611328E-06 seconds<br />
Output for 5.1.5
Merging took 1.0967254638672E-05 seconds<br /> Foreach took 6.9141387939453E-06 seconds<br />
Output for 5.1.4
Merging took 1.1920928955078E-05 seconds<br /> Foreach took 5.0067901611328E-06 seconds<br />
Output for 5.1.3
Merging took 1.5020370483398E-05 seconds<br /> Foreach took 5.9604644775391E-06 seconds<br />
Output for 5.1.2
Merging took 8.1062316894531E-06 seconds<br /> Foreach took 4.0531158447266E-06 seconds<br />
Output for 5.1.0 - 5.1.1
Merging took 1.3113021850586E-05 seconds<br /> Foreach took 5.9604644775391E-06 seconds<br />
Output for 5.0.5
Merging took 1.3113021850586E-05 seconds<br /> Foreach took 1.1920928955078E-05 seconds<br />
Output for 5.0.0, 5.0.4
Merging took 1.0967254638672E-05 seconds<br /> Foreach took 8.1062316894531E-06 seconds<br />
Output for 5.0.3
Merging took 1.0967254638672E-05 seconds<br /> Foreach took 9.0599060058594E-06 seconds<br />
Output for 5.0.2
Merging took 8.1062316894531E-06 seconds<br /> Foreach took 7.1525573730469E-06 seconds<br />
Output for 5.0.1
Merging took 1.5974044799805E-05 seconds<br /> Foreach took 1.215934753418E-05 seconds<br />
Output for 4.4.9
Merging took 2.2999999999995E-05 seconds<br /> Foreach took 1.3999999999986E-05 seconds<br />
Output for 4.4.8
Merging took 1.2999999999985E-05 seconds<br /> Foreach took 8.000000000008E-06 seconds<br />
Output for 4.4.7
Merging took 2.1999999999994E-05 seconds<br /> Foreach took 1.2999999999985E-05 seconds<br />
Output for 4.4.6
Merging took 1.599999999996E-05 seconds<br /> Foreach took 1.000000000001E-05 seconds<br />
Output for 4.4.5
Merging took 1.4999999999987E-05 seconds<br /> Foreach took 9.0000000000368E-06 seconds<br />
Output for 4.4.4
Merging took 2.4000000000024E-05 seconds<br /> Foreach took 1.0999999999983E-05 seconds<br />
Output for 4.4.3
Merging took 1.799999999999E-05 seconds<br /> Foreach took 1.2000000000012E-05 seconds<br />
Output for 4.4.2
Merging took 1.6000000000016E-05 seconds<br /> Foreach took 6.9999999999792E-06 seconds<br />
Output for 4.4.1
Merging took 2.0999999999993E-05 seconds<br /> Foreach took 1.4000000000014E-05 seconds<br />
Output for 4.4.0
Merging took 1.6999999999989E-05 seconds<br /> Foreach took 1.4000000000014E-05 seconds<br />
Output for 4.3.11
Merging took 1.3000000000041E-05 seconds<br /> Foreach took 8.000000000008E-06 seconds<br />
Output for 4.3.10
Merging took 1.4999999999987E-05 seconds<br /> Foreach took 8.000000000008E-06 seconds<br />
Output for 4.3.9
Merging took 1.2999999999999E-05 seconds<br /> Foreach took 6.9999999999931E-06 seconds<br />
Output for 4.3.7 - 4.3.8
Merging took 2.000000000002E-05 seconds<br /> Foreach took 1.2000000000012E-05 seconds<br />
Output for 4.3.6
Merging took 1.7999999999962E-05 seconds<br /> Foreach took 9.9999999999545E-06 seconds<br />
Output for 4.3.5
Merging took 1.6999999999934E-05 seconds<br /> Foreach took 9.9999999999545E-06 seconds<br />
Output for 4.3.4
Merging took 1.2000000000012E-05 seconds<br /> Foreach took 8.000000000008E-06 seconds<br />
Output for 4.3.3
Merging took 2.0000000000006E-05 seconds<br /> Foreach took 1.2999999999999E-05 seconds<br />
Output for 4.3.2
Merging took 2.2999999999995E-05 seconds<br /> Foreach took 1.2999999999985E-05 seconds<br />
Output for 4.3.1
Merging took 2.2000000000022E-05 seconds<br /> Foreach took 1.4000000000014E-05 seconds<br />
Output for 4.3.0
Merging took 1.8999999999991E-05 seconds<br /> Foreach took 1.2000000000012E-05 seconds<br />