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); function amerge(array &$a, array &$b) { foreach ($b as $key => $value) { $a[$key] = $value; } return $a; } $startTimeFunc = microtime(true); $am = amerge($classmap1, $classmap2); $endTimeFunc = microtime(true); echo "Merging took " . (($endTimeMerge - $startTimeMerge)*1000) ." microseconds<br />\n"; //var_dump($map); echo "Foreach took " . (($endTimeForeach - $startTimeForeach)*1000) ." microseconds<br />\n"; //var_dump($classmap1); echo "Func took " . (($endTimeFunc - $startTimeFunc)*1000) ." microseconds<br />\n"; //var_dump($am);
Output for 7.0.1, 7.1.0
Merging took 0.0021457672119141 microseconds<br /> Foreach took 0.0019073486328125 microseconds<br /> Func took 0.0019073486328125 microseconds<br />
Output for 7.0.14
Merging took 0.0019073486328125 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0028610229492188 microseconds<br />
Output for 7.0.3, 7.0.12
Merging took 0.0019073486328125 microseconds<br /> Foreach took 0.0021457672119141 microseconds<br /> Func took 0.0019073486328125 microseconds<br />
Output for 7.0.6
Merging took 0.00095367431640625 microseconds<br /> Foreach took 0.0019073486328125 microseconds<br /> Func took 0.0021457672119141 microseconds<br />
Output for 7.0.5
Merging took 0.0019073486328125 microseconds<br /> Foreach took 0.0021457672119141 microseconds<br /> Func took 0.0028610229492188 microseconds<br />
Output for 7.0.4
Merging took 0.0021457672119141 microseconds<br /> Foreach took 0.00095367431640625 microseconds<br /> Func took 0.0019073486328125 microseconds<br />
Output for 7.0.2
Merging took 0.0030994415283203 microseconds<br /> Foreach took 0.0019073486328125 microseconds<br /> Func took 0.0030994415283203 microseconds<br />
Output for 7.0.0
Merging took 0.0021457672119141 microseconds<br /> Foreach took 0.0028610229492188 microseconds<br /> Func took 0.0021457672119141 microseconds<br />
Output for 5.6.4, hhvm-3.12.0
Merging took 0.0030994415283203 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for hhvm-3.10.0
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.6.21
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0081062316894531 microseconds<br />
Output for 5.6.20
Merging took 0.003814697265625 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0078678131103516 microseconds<br />
Output for 5.5.21, 5.6.13, 5.6.19
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0078678131103516 microseconds<br />
Output for 5.5.9, 5.5.22, 5.5.27, 5.6.9, 5.6.18
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0069141387939453 microseconds<br />
Output for 5.6.17
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0081062316894531 microseconds<br />
Output for 5.6.16
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0071525573730469 microseconds<br />
Output for 5.6.15
Merging took 0.0071525573730469 microseconds<br /> Foreach took 0.0078678131103516 microseconds<br /> Func took 0.010967254638672 microseconds<br />
Output for 5.6.12, 5.6.14
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0069141387939453 microseconds<br />
Output for 5.5.30 - 5.5.31, 5.5.33, 5.6.11
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0069141387939453 microseconds<br />
Output for 5.6.10
Merging took 0.003814697265625 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0059604644775391 microseconds<br />
Output for 5.5.10, 5.5.12, 5.6.8
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0059604644775391 microseconds<br />
Output for 5.6.7
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.003814697265625 microseconds<br /> Func took 0.0071525573730469 microseconds<br />
Output for 5.5.23 - 5.5.24, 5.5.28, 5.6.0, 5.6.6
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0081062316894531 microseconds<br />
Output for 5.5.35, 5.6.5
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0071525573730469 microseconds<br />
Output for 5.6.3
Merging took 0.0047683715820312 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0071525573730469 microseconds<br />
Output for 5.5.29, 5.6.2
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0071525573730469 microseconds<br />
Output for 5.6.1
Merging took 0.0028610229492188 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.5.34
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0090599060058594 microseconds<br />
Output for 5.5.11, 5.5.32
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.5.26
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.003814697265625 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.5.25
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0059604644775391 microseconds<br />
Output for 5.5.20
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0071525573730469 microseconds<br />
Output for 5.5.19
Merging took 0.0030994415283203 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0059604644775391 microseconds<br />
Output for 5.5.18
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0071525573730469 microseconds<br />
Output for 5.5.16
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0081062316894531 microseconds<br />
Output for 5.5.15
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0059604644775391 microseconds<br /> Func took 0.0081062316894531 microseconds<br />
Output for 5.5.14
Merging took 0.003814697265625 microseconds<br /> Foreach took 0.003814697265625 microseconds<br /> Func took 0.0069141387939453 microseconds<br />
Output for 5.5.13
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0069141387939453 microseconds<br />
Output for 5.5.8
Merging took 0.0028610229492188 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.5.7
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0069141387939453 microseconds<br />
Output for 5.5.6
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.003814697265625 microseconds<br /> Func took 0.0069141387939453 microseconds<br />
Output for 5.5.5
Merging took 0.0061988830566406 microseconds<br /> Foreach took 0.0028610229492188 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.5.4
Merging took 0.0081062316894531 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0047683715820312 microseconds<br />
Output for 5.3.4, 5.5.3
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.003814697265625 microseconds<br />
Output for 5.4.9, 5.5.2
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.003814697265625 microseconds<br />
Output for 5.4.10, 5.4.15, 5.5.1
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0030994415283203 microseconds<br />
Output for 5.5.0
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.003814697265625 microseconds<br /> Func took 0.0030994415283203 microseconds<br />
Output for 5.4.45
Merging took 0.0069141387939453 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0028610229492188 microseconds<br />
Output for 5.4.44
Merging took 0.0078678131103516 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.4.43
Merging took 0.0078678131103516 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.4.39, 5.4.42
Merging took 0.0088214874267578 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.4.19, 5.4.41
Merging took 0.0071525573730469 microseconds<br /> Foreach took 0.0028610229492188 microseconds<br /> Func took 0.0028610229492188 microseconds<br />
Output for 5.4.40
Merging took 0.010013580322266 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.2.0, 5.4.38
Merging took 0.010013580322266 microseconds<br /> Foreach took 0.0059604644775391 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.4.20, 5.4.25, 5.4.37
Merging took 0.0090599060058594 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.4.23, 5.4.36
Merging took 0.010013580322266 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0059604644775391 microseconds<br />
Output for 5.4.35
Merging took 0.0069141387939453 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0030994415283203 microseconds<br />
Output for 5.4.34
Merging took 0.0088214874267578 microseconds<br /> Foreach took 0.0047683715820312 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.4.4, 5.4.18, 5.4.21, 5.4.32
Merging took 0.0069141387939453 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.4.31
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0030994415283203 microseconds<br />
Output for 5.4.30
Merging took 0.0069141387939453 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0028610229492188 microseconds<br />
Output for 5.4.29
Merging took 0.0071525573730469 microseconds<br /> Foreach took 0.0028610229492188 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.4.13, 5.4.28
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.4.11, 5.4.27
Merging took 0.0069141387939453 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.4.26
Merging took 0.0071525573730469 microseconds<br /> Foreach took 0.003814697265625 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.4.24
Merging took 0.010013580322266 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0061988830566406 microseconds<br />
Output for 5.4.22
Merging took 0.010013580322266 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.4.1, 5.4.12, 5.4.14, 5.4.17
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.3.24, 5.4.16
Merging took 0.0061988830566406 microseconds<br /> Foreach took 0.003814697265625 microseconds<br /> Func took 0.0030994415283203 microseconds<br />
Output for 5.4.8
Merging took 0.013113021850586 microseconds<br /> Foreach took 0.0059604644775391 microseconds<br /> Func took 0.0081062316894531 microseconds<br />
Output for 5.4.7
Merging took 0.0069141387939453 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0030994415283203 microseconds<br />
Output for 5.4.6
Merging took 0.015020370483398 microseconds<br /> Foreach took 0.0069141387939453 microseconds<br /> Func took 0.0081062316894531 microseconds<br />
Output for 5.4.5
Merging took 0.0081062316894531 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0059604644775391 microseconds<br />
Output for 5.4.3
Merging took 0.0069141387939453 microseconds<br /> Foreach took 0.0028610229492188 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.4.2
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0028610229492188 microseconds<br />
Output for 5.4.0
Merging took 0.0061988830566406 microseconds<br /> Foreach took 0.003814697265625 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.3.12, 5.3.29
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0028610229492188 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.3.28
Merging took 0.0069141387939453 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.2.10, 5.3.11, 5.3.27
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.003814697265625 microseconds<br />
Output for 5.3.26
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0028610229492188 microseconds<br />
Output for 5.3.8, 5.3.15, 5.3.17, 5.3.23, 5.3.25
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0028610229492188 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.3.14, 5.3.22
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0028610229492188 microseconds<br />
Output for 5.3.21
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0028610229492188 microseconds<br />
Output for 5.3.20
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0028610229492188 microseconds<br /> Func took 0.0030994415283203 microseconds<br />
Output for 5.2.12, 5.3.19
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.003814697265625 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.3.18
Merging took 0.0069141387939453 microseconds<br /> Foreach took 0.003814697265625 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.3.16
Merging took 0.0071525573730469 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.2.11, 5.3.13
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.003814697265625 microseconds<br />
Output for 5.2.13, 5.3.7, 5.3.10
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.3.9
Merging took 0.0081062316894531 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.2.8, 5.2.17, 5.3.2 - 5.3.3, 5.3.6
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.3.5
Merging took 0.0071525573730469 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.3.1
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.3.0
Merging took 0.0030994415283203 microseconds<br /> Foreach took 0.0028610229492188 microseconds<br /> Func took 0.003814697265625 microseconds<br />
Output for 5.2.9, 5.2.16
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0028610229492188 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.2.15
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.2.14
Merging took 0.0069141387939453 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0069141387939453 microseconds<br />
Output for 5.2.7
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0028610229492188 microseconds<br /> Func took 0.0040531158447266 microseconds<br />
Output for 5.2.6
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0030994415283203 microseconds<br /> Func took 0.0050067901611328 microseconds<br />
Output for 5.2.5
Merging took 0.0090599060058594 microseconds<br /> Foreach took 0.0059604644775391 microseconds<br /> Func took 0.0071525573730469 microseconds<br />
Output for 5.2.4
Merging took 0.010013580322266 microseconds<br /> Foreach took 0.0059604644775391 microseconds<br /> Func took 0.0081062316894531 microseconds<br />
Output for 5.2.3
Merging took 0.0090599060058594 microseconds<br /> Foreach took 0.0059604644775391 microseconds<br /> Func took 0.0081062316894531 microseconds<br />
Output for 5.2.2
Merging took 0.0088214874267578 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0059604644775391 microseconds<br />
Output for 5.2.1
Merging took 0.0078678131103516 microseconds<br /> Foreach took 0.0061988830566406 microseconds<br /> Func took 0.0069141387939453 microseconds<br />
Output for 5.1.4, 5.1.6
Merging took 0.011205673217773 microseconds<br /> Foreach took 0.0059604644775391 microseconds<br /> Func took 0.0081062316894531 microseconds<br />
Output for 5.1.5
Merging took 0.016927719116211 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0081062316894531 microseconds<br />
Output for 5.1.3
Merging took 0.0090599060058594 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0059604644775391 microseconds<br />
Output for 5.1.2
Merging took 0.0090599060058594 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br /> Func took 0.0069141387939453 microseconds<br />
Output for 5.1.1
Merging took 0.01215934753418 microseconds<br /> Foreach took 0.0059604644775391 microseconds<br /> Func took 0.0090599060058594 microseconds<br />
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/kFgLB on line 49
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/kFgLB on line 27
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_ARRAY, expecting ')' in /in/kFgLB on line 27
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_ARRAY, expecting ')' in /in/kFgLB on line 27
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/kFgLB on line 27
Process exited with code 255.