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); $start = microtime(true); $foo = []; foreach($ar as $k => $v) $foo[$k] = call_user_func_array('cb', [$v, $k]); var_dump(microtime(true) - $start);
based on juIfu
Output for 5.6.12, 7.1.0
Array ( [0] => b ) float(2.1934509277344E-5) float(5.0067901611328E-6)
Output for 7.0.14
Array ( [0] => b ) float(3.0040740966797E-5) float(4.0531158447266E-6)
Output for 7.0.6
Array ( [0] => b ) float(2.9087066650391E-5) float(4.0531158447266E-6)
Output for 7.0.5
Array ( [0] => b ) float(2.598762512207E-5) float(2.8610229492188E-6)
Output for 7.0.4
Array ( [0] => b ) float(2.6941299438477E-5) float(3.814697265625E-6)
Output for 7.0.3
Array ( [0] => b ) float(2.7894973754883E-5) float(4.0531158447266E-6)
Output for 7.0.2
Array ( [0] => b ) float(1.6927719116211E-5) float(2.8610229492188E-6)
Output for 7.0.1
Array ( [0] => b ) float(3.504753112793E-5) float(3.0994415283203E-6)
Output for 7.0.0
Array ( [0] => b ) float(2.0027160644531E-5) float(3.0994415283203E-6)
Output for hhvm-3.12.0
Array ( [0] => b ) float(3.9100646972656E-5) float(9.0599060058594E-6)
Output for hhvm-3.10.0
Array ( [0] => b ) float(3.2186508178711E-5) float(8.1062316894531E-6)
Output for 5.6.28
Array ( [0] => b ) float(3.4093856811523E-5) float(6.9141387939453E-6)
Output for 5.6.21
Array ( [0] => b ) float(2.9087066650391E-5) float(7.8678131103516E-6)
Output for 5.6.20
Array ( [0] => b ) float(2.7894973754883E-5) float(6.9141387939453E-6)
Output for 5.6.19
Array ( [0] => b ) float(2.5033950805664E-5) float(5.9604644775391E-6)
Output for 5.6.18
Array ( [0] => b ) float(3.2901763916016E-5) float(9.0599060058594E-6)
Output for 5.6.17
Array ( [0] => b ) float(3.0040740966797E-5) float(7.1525573730469E-6)
Output for 5.6.16
Array ( [0] => b ) float(2.4080276489258E-5) float(5.9604644775391E-6)
Output for 5.5.24, 5.6.15
Array ( [0] => b ) float(3.0040740966797E-5) float(5.9604644775391E-6)
Output for 5.5.33, 5.6.14
Array ( [0] => b ) float(3.1948089599609E-5) float(6.9141387939453E-6)
Output for 5.6.13
Array ( [0] => b ) float(3.3140182495117E-5) float(9.0599060058594E-6)
Output for 5.6.11
Array ( [0] => b ) float(3.0040740966797E-5) float(1.0967254638672E-5)
Output for 5.6.10
Array ( [0] => b ) float(3.0994415283203E-5) float(7.1525573730469E-6)
Output for 5.6.9
Array ( [0] => b ) float(2.598762512207E-5) float(6.1988830566406E-6)
Output for 5.5.29, 5.6.8
Array ( [0] => b ) float(2.7894973754883E-5) float(8.1062316894531E-6)
Output for 5.5.35
Array ( [0] => b ) float(2.9802322387695E-5) float(6.9141387939453E-6)
Output for 5.5.34
Array ( [0] => b ) float(1.9073486328125E-5) float(4.0531158447266E-6)
Output for 5.5.32
Array ( [0] => b ) float(2.4080276489258E-5) float(8.1062316894531E-6)
Output for 5.5.31
Array ( [0] => b ) float(2.8133392333984E-5) float(5.9604644775391E-6)
Output for 5.5.30
Array ( [0] => b ) float(3.2901763916016E-5) float(7.8678131103516E-6)
Output for 5.5.28
Array ( [0] => b ) float(2.6941299438477E-5) float(6.9141387939453E-6)
Output for 5.5.27
Array ( [0] => b ) float(2.598762512207E-5) float(7.1525573730469E-6)
Output for 5.5.26
Array ( [0] => b ) float(3.1948089599609E-5) float(8.1062316894531E-6)
Output for 5.5.25
Array ( [0] => b ) float(2.9802322387695E-5) float(8.1062316894531E-6)
Output for 5.4.45
Array ( [0] => b ) float(0.0013771057128906) float(1.3828277587891E-5)
Output for 5.4.44
Array ( [0] => b ) float(2.8133392333984E-5) float(8.1062316894531E-6)
Output for 5.4.43
Array ( [0] => b ) float(0.019222021102905) float(1.6927719116211E-5)
Output for 5.4.42
Array ( [0] => b ) float(0.00010418891906738) float(8.1062316894531E-6)
Output for 5.4.41
Array ( [0] => b ) float(3.6001205444336E-5) float(1.7881393432617E-5)
Output for 5.4.40
Array ( [0] => b ) float(8.5830688476562E-5) float(6.9141387939453E-6)
Output for 5.4.39
Array ( [0] => b ) float(9.608268737793E-5) float(7.8678131103516E-6)
Output for 5.4.38
Array ( [0] => b ) float(0.00026798248291016) float(1.3113021850586E-5)
Output for 5.4.37
Array ( [0] => b ) float(0.0093061923980713) float(2.8848648071289E-5)
Output for 5.4.36
Array ( [0] => b ) float(0.00019717216491699) float(1.3828277587891E-5)
Output for 5.4.35
Array ( [0] => b ) float(6.1988830566406E-5) float(1.3113021850586E-5)
Output for 5.4.34
Array ( [0] => b ) float(0.00046110153198242) float(1.9073486328125E-5)
Output for 5.4.32
Array ( [0] => b ) float(0.00010514259338379) float(9.0599060058594E-6)
Output for 5.4.31
Array ( [0] => b ) float(0.00011301040649414) float(8.8214874267578E-6)
Output for 5.4.30
Array ( [0] => b ) float(0.00013303756713867) float(1.0013580322266E-5)
Output for 5.4.29
Array ( [0] => b ) float(0.00011801719665527) float(8.1062316894531E-6)
Output for 5.4.28
Array ( [0] => b ) float(0.00014305114746094) float(1.0967254638672E-5)
Output for 5.4.27
Array ( [0] => b ) float(0.00011682510375977) float(9.0599060058594E-6)
Output for 5.4.26
Array ( [0] => b ) float(0.00011920928955078) float(7.8678131103516E-6)
Output for 5.4.25
Array ( [0] => b ) float(0.00013279914855957) float(1.0013580322266E-5)
Output for 5.4.24
Array ( [0] => b ) float(0.00011515617370605) float(1.0967254638672E-5)
Output for 5.4.23
Array ( [0] => b ) float(0.00011181831359863) float(9.0599060058594E-6)
Output for 5.4.22
Array ( [0] => b ) float(0.00011992454528809) float(9.0599060058594E-6)
Output for 5.4.21
Array ( [0] => b ) float(0.00017189979553223) float(9.0599060058594E-6)
Output for 5.4.18, 5.4.20
Array ( [0] => b ) float(0.00013399124145508) float(1.0967254638672E-5)
Output for 5.4.19
Array ( [0] => b ) float(0.0001370906829834) float(1.0013580322266E-5)
Output for 5.4.17
Array ( [0] => b ) float(0.0001671314239502) float(1.0967254638672E-5)
Output for 5.4.16
Array ( [0] => b ) float(0.00017404556274414) float(1.0013580322266E-5)
Output for 5.4.15
Array ( [0] => b ) float(0.00014901161193848) float(1.2874603271484E-5)
Output for 5.4.14
Array ( [0] => b ) float(0.00012707710266113) float(1.0013580322266E-5)
Output for 5.4.13
Array ( [0] => b ) float(0.00012302398681641) float(1.215934753418E-5)
Output for 5.4.12
Array ( [0] => b ) float(0.00017380714416504) float(1.0013580322266E-5)
Output for 5.4.11
Array ( [0] => b ) float(0.0069160461425781) float(2.0980834960938E-5)
Output for 5.4.10
Array ( [0] => b ) float(0.00011205673217773) float(9.0599060058594E-6)
Output for 5.4.9
Array ( [0] => b ) float(0.00013113021850586) float(1.0967254638672E-5)
Output for 5.4.8
Array ( [0] => b ) float(0.00013995170593262) float(1.0967254638672E-5)
Output for 5.4.7
Array ( [0] => b ) float(0.00013303756713867) float(1.0967254638672E-5)
Output for 5.4.6
Array ( [0] => b ) float(0.00011086463928223) float(7.8678131103516E-6)
Output for 5.4.5
Array ( [0] => b ) float(0.00013303756713867) float(1.1205673217773E-5)
Output for 5.4.4
Array ( [0] => b ) float(0.00017809867858887) float(1.0967254638672E-5)
Output for 5.4.3
Array ( [0] => b ) float(0.00014615058898926) float(8.8214874267578E-6)
Output for 5.4.2
Array ( [0] => b ) float(0.0001838207244873) float(1.1920928955078E-5)
Output for 5.4.1
Array ( [0] => b ) float(0.0001368522644043) float(1.9073486328125E-5)
Output for 5.4.0
Array ( [0] => b ) float(0.00014996528625488) float(1.0013580322266E-5)
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/2UGbh 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/2UGbh on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/2UGbh on line 2
Process exited with code 255.