3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $ar = ['a' => 'b']; $keys = ['a' => 'a']; function cb($v, $k){ return $v; } $start = microtime(true); print_r( array_map('cb', $ar, $keys) ); var_dump((microtime(true) - $start)*1000); $start = microtime(true); $foo = []; foreach($ar as $k => $v) $foo[$k] = call_user_func_array('cb', [$v, $k]); var_dump((microtime(true) - $start)*1000);
based on 2UGbh
Output for 5.4.15, 5.4.22, 5.5.27, 7.1.0
Array ( [0] => b ) float(0.023126602172852) float(0.0050067901611328)
Output for 7.0.14
Array ( [0] => b ) float(0.044107437133789) float(0.0040531158447266)
Output for 7.0.6
Array ( [0] => b ) float(0.015974044799805) float(0.0030994415283203)
Output for 7.0.5
Array ( [0] => b ) float(0.020027160644531) float(0.0040531158447266)
Output for 7.0.4
Array ( [0] => b ) float(0.030040740966797) float(0.0028610229492188)
Output for 7.0.3
Array ( [0] => b ) float(0.023126602172852) float(0.010013580322266)
Output for 7.0.2
Array ( [0] => b ) float(0.024080276489258) float(0.0040531158447266)
Output for 7.0.1
Array ( [0] => b ) float(0.030040740966797) float(0.0040531158447266)
Output for 7.0.0
Array ( [0] => b ) float(0.027894973754883) float(0.003814697265625)
Output for 5.4.4, hhvm-3.12.0
Array ( [0] => b ) float(0.030994415283203) float(0.0071525573730469)
Output for hhvm-3.10.0
Array ( [0] => b ) float(0.03814697265625) float(0.0090599060058594)
Output for 5.6.28
Array ( [0] => b ) float(0.034093856811523) float(0.0071525573730469)
Output for 5.4.29, 5.6.21
Array ( [0] => b ) float(0.027894973754883) float(0.0059604644775391)
Output for 5.6.19 - 5.6.20
Array ( [0] => b ) float(0.030994415283203) float(0.0069141387939453)
Output for 5.6.18
Array ( [0] => b ) float(0.031948089599609) float(0.0090599060058594)
Output for 5.6.17
Array ( [0] => b ) float(0.023126602172852) float(0.0059604644775391)
Output for 5.6.16
Array ( [0] => b ) float(0.024080276489258) float(0.0081062316894531)
Output for 5.6.15
Array ( [0] => b ) float(0.030994415283203) float(0.0090599060058594)
Output for 5.6.14
Array ( [0] => b ) float(0.029802322387695) float(0.0059604644775391)
Output for 5.6.13
Array ( [0] => b ) float(0.027894973754883) float(0.0050067901611328)
Output for 5.4.31, 5.4.42, 5.5.24, 5.5.29, 5.6.12
Array ( [0] => b ) float(0.030040740966797) float(0.0069141387939453)
Output for 5.6.11
Array ( [0] => b ) float(0.032901763916016) float(0.0078678131103516)
Output for 5.6.10
Array ( [0] => b ) float(0.030040740966797) float(0.0081062316894531)
Output for 5.4.32, 5.6.9
Array ( [0] => b ) float(0.032901763916016) float(0.0071525573730469)
Output for 5.6.8
Array ( [0] => b ) float(0.028133392333984) float(0.0061988830566406)
Output for 5.5.35
Array ( [0] => b ) float(0.027179718017578) float(0.0069141387939453)
Output for 5.5.30, 5.5.34
Array ( [0] => b ) float(0.025033950805664) float(0.0059604644775391)
Output for 5.5.33
Array ( [0] => b ) float(0.040054321289062) float(0.0081062316894531)
Output for 5.5.32
Array ( [0] => b ) float(0.029087066650391) float(0.0071525573730469)
Output for 5.5.31
Array ( [0] => b ) float(0.02288818359375) float(0.0050067901611328)
Output for 5.5.28
Array ( [0] => b ) float(0.036954879760742) float(0.010013580322266)
Output for 5.4.12, 5.5.26
Array ( [0] => b ) float(0.024080276489258) float(0.0059604644775391)
Output for 5.5.25
Array ( [0] => b ) float(0.02288818359375) float(0.0071525573730469)
Output for 5.4.37, 5.4.45
Array ( [0] => b ) float(0.031948089599609) float(0.0069141387939453)
Output for 5.4.28, 5.4.44
Array ( [0] => b ) float(0.025033950805664) float(0.0047683715820312)
Output for 5.4.43
Array ( [0] => b ) float(0.02598762512207) float(0.0050067901611328)
Output for 5.4.41
Array ( [0] => b ) float(0.028848648071289) float(0.0059604644775391)
Output for 5.4.40
Array ( [0] => b ) float(0.028848648071289) float(0.0069141387939453)
Output for 5.4.39
Array ( [0] => b ) float(0.054836273193359) float(0.0059604644775391)
Output for 5.4.38
Array ( [0] => b ) float(0.031948089599609) float(0.0078678131103516)
Output for 5.4.36
Array ( [0] => b ) float(0.03504753112793) float(0.010013580322266)
Output for 5.4.35
Array ( [0] => b ) float(0.036001205444336) float(0.0078678131103516)
Output for 5.4.34
Array ( [0] => b ) float(0.032901763916016) float(0.0069141387939453)
Output for 5.4.30
Array ( [0] => b ) float(0.036954879760742) float(0.010967254638672)
Output for 5.4.27
Array ( [0] => b ) float(0.025033950805664) float(0.0069141387939453)
Output for 5.4.26
Array ( [0] => b ) float(0.021934509277344) float(0.0061988830566406)
Output for 5.4.25
Array ( [0] => b ) float(0.022172927856445) float(0.0071525573730469)
Output for 5.4.24
Array ( [0] => b ) float(0.023841857910156) float(0.0050067901611328)
Output for 5.4.11, 5.4.14, 5.4.18, 5.4.23
Array ( [0] => b ) float(0.020980834960938) float(0.0050067901611328)
Output for 5.4.21
Array ( [0] => b ) float(0.021219253540039) float(0.0050067901611328)
Output for 5.4.20
Array ( [0] => b ) float(0.02598762512207) float(0.0081062316894531)
Output for 5.4.19
Array ( [0] => b ) float(0.02288818359375) float(0.0069141387939453)
Output for 5.4.0, 5.4.17
Array ( [0] => b ) float(0.024795532226562) float(0.0069141387939453)
Output for 5.4.9, 5.4.16
Array ( [0] => b ) float(0.020027160644531) float(0.0050067901611328)
Output for 5.4.13
Array ( [0] => b ) float(0.021934509277344) float(0.0040531158447266)
Output for 5.4.8, 5.4.10
Array ( [0] => b ) float(0.021934509277344) float(0.0050067901611328)
Output for 5.4.6 - 5.4.7
Array ( [0] => b ) float(0.031948089599609) float(0.0050067901611328)
Output for 5.4.5
Array ( [0] => b ) float(0.032186508178711) float(0.0078678131103516)
Output for 5.4.3
Array ( [0] => b ) float(0.036001205444336) float(0.0069141387939453)
Output for 5.4.2
Array ( [0] => b ) float(0.034093856811523) float(0.0059604644775391)
Output for 5.4.1
Array ( [0] => b ) float(0.028848648071289) float(0.0050067901611328)
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/KOM7d on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/KOM7d on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/KOM7d on line 2
Process exited with code 255.