3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=100; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=100; $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"; //var_dump($map); echo "Foreach took " . (($endTimeForeach - $startTimeForeach)*1000) ." microseconds<br />\n";
Output for 7.2.0
Merging took 0.0028610229492188 microseconds<br /> Foreach took 0.0050067901611328 microseconds<br />
Output for 7.1.7
Merging took 0.0040531158447266 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br />
Output for 7.1.6
Merging took 0.0081062316894531 microseconds<br /> Foreach took 0.0078678131103516 microseconds<br />
Output for 7.1.5
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0059604644775391 microseconds<br />
Output for 7.1.0
Merging took 0.003814697265625 microseconds<br /> Foreach took 0.0040531158447266 microseconds<br />
Output for 7.0.20
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.017166137695312 microseconds<br />
Output for 7.0.14
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0081062316894531 microseconds<br />
Output for 7.0.1, 7.0.7
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0071525573730469 microseconds<br />
Output for 7.0.6
Merging took 0.0069141387939453 microseconds<br /> Foreach took 0.0081062316894531 microseconds<br />
Output for 7.0.3, 7.0.5
Merging took 0.0059604644775391 microseconds<br /> Foreach took 0.0069141387939453 microseconds<br />
Output for 7.0.4
Merging took 0.023841857910156 microseconds<br /> Foreach took 0.0081062316894531 microseconds<br />
Output for 7.0.2
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0069141387939453 microseconds<br />
Output for 7.0.0
Merging took 0.0050067901611328 microseconds<br /> Foreach took 0.0059604644775391 microseconds<br />
Output for 5.6.8, 5.6.28
Merging took 0.03504753112793 microseconds<br /> Foreach took 0.027894973754883 microseconds<br />
Output for 5.6.22
Merging took 0.030994415283203 microseconds<br /> Foreach took 0.046014785766602 microseconds<br />
Output for 5.2.10, 5.6.21
Merging took 0.041007995605469 microseconds<br /> Foreach took 0.024080276489258 microseconds<br />
Output for 5.6.20
Merging took 0.031232833862305 microseconds<br /> Foreach took 0.024795532226562 microseconds<br />
Output for 5.6.19
Merging took 0.024080276489258 microseconds<br /> Foreach took 0.021934509277344 microseconds<br />
Output for 5.6.18
Merging took 0.036001205444336 microseconds<br /> Foreach took 0.025033950805664 microseconds<br />
Output for 5.6.17
Merging took 0.036001205444336 microseconds<br /> Foreach took 0.02598762512207 microseconds<br />
Output for 5.5.7, 5.5.26, 5.5.32, 5.6.7, 5.6.16
Merging took 0.03504753112793 microseconds<br /> Foreach took 0.028133392333984 microseconds<br />
Output for 5.6.15
Merging took 0.03814697265625 microseconds<br /> Foreach took 0.030040740966797 microseconds<br />
Output for 5.6.14
Merging took 0.032186508178711 microseconds<br /> Foreach took 0.025033950805664 microseconds<br />
Output for 5.6.13
Merging took 0.036954879760742 microseconds<br /> Foreach took 0.027894973754883 microseconds<br />
Output for 5.6.12
Merging took 0.026941299438477 microseconds<br /> Foreach took 0.020980834960938 microseconds<br />
Output for 5.6.11
Merging took 0.032901763916016 microseconds<br /> Foreach took 0.024080276489258 microseconds<br />
Output for 5.6.10
Merging took 0.02288818359375 microseconds<br /> Foreach took 0.022172927856445 microseconds<br />
Output for 5.5.9, 5.6.9
Merging took 0.032901763916016 microseconds<br /> Foreach took 0.02598762512207 microseconds<br />
Output for 5.6.5 - 5.6.6
Merging took 0.030994415283203 microseconds<br /> Foreach took 0.023126602172852 microseconds<br />
Output for 5.5.33, 5.6.4
Merging took 0.036954879760742 microseconds<br /> Foreach took 0.030040740966797 microseconds<br />
Output for 5.6.3
Merging took 0.029087066650391 microseconds<br /> Foreach took 0.021934509277344 microseconds<br />
Output for 5.6.2
Merging took 0.046014785766602 microseconds<br /> Foreach took 0.037908554077148 microseconds<br />
Output for 5.6.1
Merging took 0.036954879760742 microseconds<br /> Foreach took 0.034093856811523 microseconds<br />
Output for 5.6.0
Merging took 0.039815902709961 microseconds<br /> Foreach took 0.030994415283203 microseconds<br />
Output for 5.5.35 - 5.5.36
Merging took 0.036001205444336 microseconds<br /> Foreach took 0.027894973754883 microseconds<br />
Output for 5.5.34
Merging took 0.033855438232422 microseconds<br /> Foreach took 0.027179718017578 microseconds<br />
Output for 5.5.31
Merging took 0.046014785766602 microseconds<br /> Foreach took 0.028848648071289 microseconds<br />
Output for 5.5.20, 5.5.30
Merging took 0.030040740966797 microseconds<br /> Foreach took 0.024080276489258 microseconds<br />
Output for 5.5.29
Merging took 0.036001205444336 microseconds<br /> Foreach took 0.029087066650391 microseconds<br />
Output for 5.5.23, 5.5.28
Merging took 0.034093856811523 microseconds<br /> Foreach took 0.026941299438477 microseconds<br />
Output for 5.5.27
Merging took 0.03504753112793 microseconds<br /> Foreach took 0.028848648071289 microseconds<br />
Output for 5.5.25
Merging took 0.028848648071289 microseconds<br /> Foreach took 0.023126602172852 microseconds<br />
Output for 5.5.24
Merging took 0.037908554077148 microseconds<br /> Foreach took 0.027894973754883 microseconds<br />
Output for 5.5.22
Merging took 0.026941299438477 microseconds<br /> Foreach took 0.021934509277344 microseconds<br />
Output for 5.5.21
Merging took 0.023841857910156 microseconds<br /> Foreach took 0.019073486328125 microseconds<br />
Output for 5.5.19
Merging took 0.034809112548828 microseconds<br /> Foreach took 0.039815902709961 microseconds<br />
Output for 5.5.18
Merging took 0.026941299438477 microseconds<br /> Foreach took 0.022172927856445 microseconds<br />
Output for 5.5.16
Merging took 0.030994415283203 microseconds<br /> Foreach took 0.025033950805664 microseconds<br />
Output for 5.5.15
Merging took 0.025033950805664 microseconds<br /> Foreach took 0.020027160644531 microseconds<br />
Output for 5.5.14
Merging took 0.020980834960938 microseconds<br /> Foreach took 0.018835067749023 microseconds<br />
Output for 5.5.13
Merging took 0.041007995605469 microseconds<br /> Foreach took 0.029087066650391 microseconds<br />
Output for 5.5.12
Merging took 0.037193298339844 microseconds<br /> Foreach took 0.030040740966797 microseconds<br />
Output for 5.5.11
Merging took 0.036001205444336 microseconds<br /> Foreach took 0.043153762817383 microseconds<br />
Output for 5.5.10
Merging took 0.030040740966797 microseconds<br /> Foreach took 0.023841857910156 microseconds<br />
Output for 5.5.8
Merging took 0.040054321289062 microseconds<br /> Foreach took 0.030040740966797 microseconds<br />
Output for 5.5.6
Merging took 0.030994415283203 microseconds<br /> Foreach took 0.024080276489258 microseconds<br />
Output for 5.5.5
Merging took 0.071048736572266 microseconds<br /> Foreach took 0.021934509277344 microseconds<br />
Output for 5.5.4
Merging took 0.062942504882812 microseconds<br /> Foreach took 0.024080276489258 microseconds<br />
Output for 5.5.3
Merging took 0.055074691772461 microseconds<br /> Foreach took 0.020980834960938 microseconds<br />
Output for 5.5.2
Merging took 0.046968460083008 microseconds<br /> Foreach took 0.017166137695312 microseconds<br />
Output for 5.5.1
Merging took 0.03814697265625 microseconds<br /> Foreach took 0.013828277587891 microseconds<br />
Output for 5.5.0
Merging took 0.058174133300781 microseconds<br /> Foreach took 0.020980834960938 microseconds<br />
Output for 5.4.45
Merging took 0.044107437133789 microseconds<br /> Foreach took 0.015974044799805 microseconds<br />
Output for 5.4.44
Merging took 0.056982040405273 microseconds<br /> Foreach took 0.021934509277344 microseconds<br />
Output for 5.4.34, 5.4.43
Merging took 0.037908554077148 microseconds<br /> Foreach took 0.013113021850586 microseconds<br />
Output for 5.4.42
Merging took 0.06103515625 microseconds<br /> Foreach took 0.02288818359375 microseconds<br />
Output for 5.4.41
Merging took 0.072956085205078 microseconds<br /> Foreach took 0.02288818359375 microseconds<br />
Output for 5.4.8, 5.4.40
Merging took 0.059127807617188 microseconds<br /> Foreach took 0.020980834960938 microseconds<br />
Output for 5.4.39
Merging took 0.05793571472168 microseconds<br /> Foreach took 0.022172927856445 microseconds<br />
Output for 5.4.38
Merging took 0.041007995605469 microseconds<br /> Foreach took 0.015020370483398 microseconds<br />
Output for 5.4.37
Merging took 0.056982040405273 microseconds<br /> Foreach took 0.020980834960938 microseconds<br />
Output for 5.4.36
Merging took 0.038862228393555 microseconds<br /> Foreach took 0.015020370483398 microseconds<br />
Output for 5.4.35
Merging took 0.058889389038086 microseconds<br /> Foreach took 0.020980834960938 microseconds<br />
Output for 5.4.11, 5.4.32
Merging took 0.036001205444336 microseconds<br /> Foreach took 0.012874603271484 microseconds<br />
Output for 5.4.31
Merging took 0.056982040405273 microseconds<br /> Foreach took 0.022172927856445 microseconds<br />
Output for 5.4.30
Merging took 0.053167343139648 microseconds<br /> Foreach took 0.01978874206543 microseconds<br />
Output for 5.4.0, 5.4.4, 5.4.20, 5.4.27, 5.4.29
Merging took 0.051021575927734 microseconds<br /> Foreach took 0.019073486328125 microseconds<br />
Output for 5.4.28
Merging took 0.039815902709961 microseconds<br /> Foreach took 0.015020370483398 microseconds<br />
Output for 5.4.26
Merging took 0.066995620727539 microseconds<br /> Foreach took 0.023126602172852 microseconds<br />
Output for 5.4.16, 5.4.25
Merging took 0.056982040405273 microseconds<br /> Foreach took 0.020027160644531 microseconds<br />
Output for 5.4.24
Merging took 0.046014785766602 microseconds<br /> Foreach took 0.017166137695312 microseconds<br />
Output for 5.4.23
Merging took 0.056028366088867 microseconds<br /> Foreach took 0.020027160644531 microseconds<br />
Output for 5.4.22
Merging took 0.059127807617188 microseconds<br /> Foreach took 0.021934509277344 microseconds<br />
Output for 5.4.21
Merging took 0.049114227294922 microseconds<br /> Foreach took 0.017881393432617 microseconds<br />
Output for 5.4.19
Merging took 0.056028366088867 microseconds<br /> Foreach took 0.025033950805664 microseconds<br />
Output for 5.4.18
Merging took 0.041961669921875 microseconds<br /> Foreach took 0.015020370483398 microseconds<br />
Output for 5.4.17
Merging took 0.048160552978516 microseconds<br /> Foreach took 0.016927719116211 microseconds<br />
Output for 5.4.15
Merging took 0.061988830566406 microseconds<br /> Foreach took 0.022172927856445 microseconds<br />
Output for 5.4.14
Merging took 0.041007995605469 microseconds<br /> Foreach took 0.014066696166992 microseconds<br />
Output for 5.4.13
Merging took 0.06103515625 microseconds<br /> Foreach took 0.029087066650391 microseconds<br />
Output for 5.4.12
Merging took 0.050067901611328 microseconds<br /> Foreach took 0.016927719116211 microseconds<br />
Output for 5.4.10
Merging took 0.065088272094727 microseconds<br /> Foreach took 0.021934509277344 microseconds<br />
Output for 5.4.9
Merging took 0.065088272094727 microseconds<br /> Foreach took 0.020980834960938 microseconds<br />
Output for 5.4.7
Merging took 0.059843063354492 microseconds<br /> Foreach took 0.022172927856445 microseconds<br />
Output for 5.4.6
Merging took 0.056028366088867 microseconds<br /> Foreach took 0.020980834960938 microseconds<br />
Output for 5.4.5
Merging took 0.060081481933594 microseconds<br /> Foreach took 0.020980834960938 microseconds<br />
Output for 5.4.3
Merging took 0.053167343139648 microseconds<br /> Foreach took 0.017881393432617 microseconds<br />
Output for 5.4.2
Merging took 0.056028366088867 microseconds<br /> Foreach took 0.021934509277344 microseconds<br />
Output for 5.4.1
Merging took 0.038862228393555 microseconds<br /> Foreach took 0.013113021850586 microseconds<br />
Output for 5.3.29
Merging took 0.049114227294922 microseconds<br /> Foreach took 0.024080276489258 microseconds<br />
Output for 5.3.28
Merging took 0.043153762817383 microseconds<br /> Foreach took 0.021934509277344 microseconds<br />
Output for 5.3.27
Merging took 0.044107437133789 microseconds<br /> Foreach took 0.020980834960938 microseconds<br />
Output for 5.3.26
Merging took 0.036954879760742 microseconds<br /> Foreach took 0.016927719116211 microseconds<br />
Output for 5.3.25
Merging took 0.051975250244141 microseconds<br /> Foreach took 0.024080276489258 microseconds<br />
Output for 5.3.24
Merging took 0.051975250244141 microseconds<br /> Foreach took 0.025033950805664 microseconds<br />
Output for 5.3.23
Merging took 0.051021575927734 microseconds<br /> Foreach took 0.027894973754883 microseconds<br />
Output for 5.3.22
Merging took 0.03814697265625 microseconds<br /> Foreach took 0.018835067749023 microseconds<br />
Output for 5.3.21
Merging took 0.031948089599609 microseconds<br /> Foreach took 0.02598762512207 microseconds<br />
Output for 5.3.20
Merging took 0.046014785766602 microseconds<br /> Foreach took 0.02288818359375 microseconds<br />
Output for 5.3.19
Merging took 0.054836273193359 microseconds<br /> Foreach took 0.021934509277344 microseconds<br />
Output for 5.3.17 - 5.3.18
Merging took 0.051021575927734 microseconds<br /> Foreach took 0.025033950805664 microseconds<br />
Output for 5.3.16
Merging took 0.056028366088867 microseconds<br /> Foreach took 0.026941299438477 microseconds<br />
Output for 5.3.15
Merging took 0.04887580871582 microseconds<br /> Foreach took 0.024080276489258 microseconds<br />
Output for 5.3.14
Merging took 0.039815902709961 microseconds<br /> Foreach took 0.020027160644531 microseconds<br />
Output for 5.3.13
Merging took 0.046014785766602 microseconds<br /> Foreach took 0.021934509277344 microseconds<br />
Output for 5.3.12
Merging took 0.05793571472168 microseconds<br /> Foreach took 0.027894973754883 microseconds<br />
Output for 5.3.11
Merging took 0.046014785766602 microseconds<br /> Foreach took 0.027179718017578 microseconds<br />
Output for 5.3.10
Merging took 0.042200088500977 microseconds<br /> Foreach took 0.014781951904297 microseconds<br />
Output for 5.3.9
Merging took 0.051975250244141 microseconds<br /> Foreach took 0.026941299438477 microseconds<br />
Output for 5.3.8
Merging took 0.034809112548828 microseconds<br /> Foreach took 0.014781951904297 microseconds<br />
Output for 5.2.3, 5.3.7
Merging took 0.031948089599609 microseconds<br /> Foreach took 0.014066696166992 microseconds<br />
Output for 5.3.6
Merging took 0.04887580871582 microseconds<br /> Foreach took 0.02288818359375 microseconds<br />
Output for 5.3.5
Merging took 0.041961669921875 microseconds<br /> Foreach took 0.018835067749023 microseconds<br />
Output for 5.3.4
Merging took 0.050067901611328 microseconds<br /> Foreach took 0.021934509277344 microseconds<br />
Output for 5.3.3
Merging took 0.044822692871094 microseconds<br /> Foreach took 0.023126602172852 microseconds<br />
Output for 5.2.5, 5.3.2
Merging took 0.052928924560547 microseconds<br /> Foreach took 0.025033950805664 microseconds<br />
Output for 5.3.1
Merging took 0.025033950805664 microseconds<br /> Foreach took 0.011920928955078 microseconds<br />
Output for 5.3.0
Merging took 0.017166137695312 microseconds<br /> Foreach took 0.02598762512207 microseconds<br />
Output for 5.2.17
Merging took 0.046014785766602 microseconds<br /> Foreach took 0.02598762512207 microseconds<br />
Output for 5.2.16
Merging took 0.039100646972656 microseconds<br /> Foreach took 0.021934509277344 microseconds<br />
Output for 5.2.15
Merging took 0.047922134399414 microseconds<br /> Foreach took 0.028848648071289 microseconds<br />
Output for 5.2.14
Merging took 0.044822692871094 microseconds<br /> Foreach took 0.026226043701172 microseconds<br />
Output for 5.2.13
Merging took 0.053882598876953 microseconds<br /> Foreach took 0.031948089599609 microseconds<br />
Output for 5.2.12
Merging took 0.047922134399414 microseconds<br /> Foreach took 0.030040740966797 microseconds<br />
Output for 5.2.11
Merging took 0.025033950805664 microseconds<br /> Foreach took 0.030994415283203 microseconds<br />
Output for 5.2.9
Merging took 0.041961669921875 microseconds<br /> Foreach took 0.023841857910156 microseconds<br />
Output for 5.2.8
Merging took 0.046014785766602 microseconds<br /> Foreach took 0.025033950805664 microseconds<br />
Output for 5.2.7
Merging took 0.052928924560547 microseconds<br /> Foreach took 0.030040740966797 microseconds<br />
Output for 5.2.6
Merging took 0.037908554077148 microseconds<br /> Foreach took 0.020027160644531 microseconds<br />
Output for 5.2.4
Merging took 0.030994415283203 microseconds<br /> Foreach took 0.014066696166992 microseconds<br />
Output for 5.2.2
Merging took 0.036001205444336 microseconds<br /> Foreach took 0.016927719116211 microseconds<br />
Output for 5.2.1
Merging took 0.029087066650391 microseconds<br /> Foreach took 0.015974044799805 microseconds<br />
Output for 5.2.0
Merging took 0.026941299438477 microseconds<br /> Foreach took 0.016927719116211 microseconds<br />
Output for 5.1.6
Merging took 0.051021575927734 microseconds<br /> Foreach took 0.021934509277344 microseconds<br />
Output for 5.1.5
Merging took 0.040054321289062 microseconds<br /> Foreach took 0.016927719116211 microseconds<br />
Output for 5.1.4
Merging took 0.033855438232422 microseconds<br /> Foreach took 0.014066696166992 microseconds<br />
Output for 5.1.3
Merging took 0.042915344238281 microseconds<br /> Foreach took 0.018119812011719 microseconds<br />
Output for 5.1.2
Merging took 0.038862228393555 microseconds<br /> Foreach took 0.016212463378906 microseconds<br />
Output for 5.1.1
Merging took 0.049114227294922 microseconds<br /> Foreach took 0.020027160644531 microseconds<br />
Output for 5.1.0
Merging took 0.049114227294922 microseconds<br /> Foreach took 0.027894973754883 microseconds<br />
Output for 5.0.5
Merging took 0.058174133300781 microseconds<br /> Foreach took 0.05793571472168 microseconds<br />
Output for 5.0.4
Merging took 0.041007995605469 microseconds<br /> Foreach took 0.038862228393555 microseconds<br />
Output for 5.0.3
Merging took 0.041961669921875 microseconds<br /> Foreach took 0.040054321289062 microseconds<br />
Output for 5.0.2
Merging took 0.051975250244141 microseconds<br /> Foreach took 0.046014785766602 microseconds<br />
Output for 5.0.1
Merging took 0.044107437133789 microseconds<br /> Foreach took 0.038862228393555 microseconds<br />
Output for 5.0.0
Merging took 0.051975250244141 microseconds<br /> Foreach took 0.051021575927734 microseconds<br />
Output for 4.4.9
Merging took 0.065 microseconds<br /> Foreach took 0.059 microseconds<br />
Output for 4.4.8
Merging took 0.064 microseconds<br /> Foreach took 0.066 microseconds<br />
Output for 4.4.7
Merging took 0.04 microseconds<br /> Foreach took 0.033 microseconds<br />
Output for 4.4.6
Merging took 0.039 microseconds<br /> Foreach took 0.033 microseconds<br />
Output for 4.4.5
Merging took 0.046 microseconds<br /> Foreach took 0.042 microseconds<br />
Output for 4.4.4
Merging took 0.057 microseconds<br /> Foreach took 0.058 microseconds<br />
Output for 4.4.3
Merging took 0.057 microseconds<br /> Foreach took 0.05 microseconds<br />
Output for 4.4.2
Merging took 0.072 microseconds<br /> Foreach took 0.068 microseconds<br />
Output for 4.4.1
Merging took 0.048 microseconds<br /> Foreach took 0.044 microseconds<br />
Output for 4.4.0
Merging took 0.054 microseconds<br /> Foreach took 0.05 microseconds<br />
Output for 4.3.11
Merging took 0.05 microseconds<br /> Foreach took 0.037 microseconds<br />
Output for 4.3.10
Merging took 0.08 microseconds<br /> Foreach took 0.062 microseconds<br />
Output for 4.3.9
Merging took 0.064 microseconds<br /> Foreach took 0.039 microseconds<br />
Output for 4.3.8
Merging took 0.05 microseconds<br /> Foreach took 0.039 microseconds<br />
Output for 4.3.7
Merging took 0.049 microseconds<br /> Foreach took 0.038 microseconds<br />
Output for 4.3.6
Merging took 0.051 microseconds<br /> Foreach took 0.039 microseconds<br />
Output for 4.3.5
Merging took 0.05 microseconds<br /> Foreach took 0.038 microseconds<br />
Output for 4.3.4
Merging took 0.05 microseconds<br /> Foreach took 0.046 microseconds<br />
Output for 4.3.3
Merging took 0.047 microseconds<br /> Foreach took 0.04 microseconds<br />
Output for 4.3.2
Merging took 0.05 microseconds<br /> Foreach took 0.04 microseconds<br />
Output for 4.3.1
Merging took 0.062 microseconds<br /> Foreach took 0.048 microseconds<br />
Output for 4.3.0
Merging took 0.049 microseconds<br /> Foreach took 0.042 microseconds<br />

preferences:
168.7 ms | 401 KiB | 208 Q