3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = [ [1, 'xxx', 'yyy'], [2, 'xxx', 'yyy'], [3, 'xxx', 'yyy'], [4, 'xxx', 'yyy'], [5, 'xxx', 'yyy'], [6, 'xxx', 'yyy'], [7, 'xxx', 'yyy'], [8, 'xxx', 'yyy'], [9, 'xxx', 'yyy'], [10, 'xxx', 'yyy'], [11, 'xxx', 'yyy'], [12, 'xxx', 'yyy'], [13, 'xxx', 'yyy'], [14, 'xxx', 'yyy'], [15, 'xxx', 'yyy'], [16, 'xxx', 'yyy'], [17, 'xxx', 'yyy'], [18, 'xxx', 'yyy'], [19, 'xxx', 'yyy'] ]; $t = microtime(true); $result = array_map(function($v){ return $v[0]; }, $array); echo number_format(microtime(true) - $t, 10), PHP_EOL; $t = microtime(true); $result = array(); foreach($array as $v)$result[] = $v[0]; echo number_format(microtime(true) - $t, 10), PHP_EOL; ?>
Output for 7.1.0
0.0000128746 0.0000059605
Output for 7.0.7, 7.0.14
0.0000131130 0.0000050068
Output for 7.0.13
0.0000190735 0.0000069141
Output for 7.0.12
0.0000159740 0.0000050068
Output for 7.0.11
0.0000131130 0.0000059605
Output for 7.0.10
0.0000150204 0.0000059605
Output for 7.0.6, 7.0.9
0.0000119209 0.0000050068
Output for 7.0.8
0.0000100136 0.0000040531
Output for 7.0.5
0.0000121593 0.0000040531
Output for 7.0.1, 7.0.4
0.0000109673 0.0000040531
Output for 7.0.3
0.0000169277 0.0000059605
Output for 7.0.2
0.0000112057 0.0000050068
Output for 7.0.0
0.0000109673 0.0000038147
Output for 5.6.29
0.0000181198 0.0000069141
Output for 5.5.21, 5.5.28, 5.6.5, 5.6.28
0.0000259876 0.0000090599
Output for 5.6.27
0.0000259876 0.0000128746
Output for 5.6.26
0.0000240803 0.0000088215
Output for 5.4.17, 5.5.7, 5.5.31, 5.6.25
0.0000240803 0.0000090599
Output for 5.6.24
0.0000331402 0.0000090599
Output for 5.4.38, 5.4.44, 5.5.1, 5.5.4 - 5.5.6, 5.6.3, 5.6.6, 5.6.23
0.0000250340 0.0000100136
Output for 5.6.22
0.0000228882 0.0000090599
Output for 5.5.35, 5.6.21
0.0000200272 0.0000078678
Output for 5.5.36, 5.6.16, 5.6.20
0.0000200272 0.0000090599
Output for 5.6.19
0.0000200272 0.0000088215
Output for 5.4.40, 5.5.13, 5.5.20, 5.5.29, 5.5.33, 5.6.13, 5.6.17 - 5.6.18
0.0000200272 0.0000081062
Output for 5.5.15, 5.5.25, 5.6.15
0.0000250340 0.0000090599
Output for 5.6.14
0.0000212193 0.0000069141
Output for 5.6.12
0.0000190735 0.0000090599
Output for 5.6.11
0.0000269413 0.0000097752
Output for 5.4.43, 5.5.8, 5.6.1, 5.6.10
0.0000259876 0.0000100136
Output for 5.6.9
0.0000271797 0.0000100136
Output for 5.6.8
0.0000278950 0.0000090599
Output for 5.6.7
0.0000250340 0.0000097752
Output for 5.6.4
0.0000190735 0.0000071526
Output for 5.6.2
0.0000188351 0.0000081062
Output for 5.4.16, 5.4.31, 5.6.0
0.0000238419 0.0000100136
Output for 5.5.38
0.0000209808 0.0000071526
Output for 5.4.21, 5.4.30, 5.4.42, 5.5.14, 5.5.37
0.0000250340 0.0000109673
Output for 5.5.34
0.0000300407 0.0000131130
Output for 5.5.32
0.0000219345 0.0000090599
Output for 5.5.30
0.0000190735 0.0000088215
Output for 5.5.27
0.0000240803 0.0000097752
Output for 5.4.2, 5.5.18, 5.5.26
0.0000259876 0.0000109673
Output for 5.5.24
0.0000259876 0.0000131130
Output for 5.4.15, 5.5.23
0.0000269413 0.0000100136
Output for 5.5.22
0.0000350475 0.0000109673
Output for 5.5.19
0.0000190735 0.0000081062
Output for 5.5.16
0.0000190735 0.0000078678
Output for 5.5.12
0.0000319481 0.0000131130
Output for 5.5.11
0.0000247955 0.0000119209
Output for 5.5.10
0.0000269413 0.0000109673
Output for 5.5.9
0.0000298023 0.0000100136
Output for 5.4.12, 5.4.32, 5.5.3
0.0000238419 0.0000090599
Output for 5.5.2
0.0000250340 0.0000088215
Output for 5.4.0, 5.4.4, 5.4.8, 5.4.23, 5.4.34, 5.4.37, 5.5.0
0.0000240803 0.0000100136
Output for 5.4.29, 5.4.45
0.0000188351 0.0000088215
Output for 5.4.41
0.0000259876 0.0000140667
Output for 5.4.11, 5.4.39
0.0000231266 0.0000100136
Output for 5.4.36
0.0000188351 0.0000100136
Output for 5.4.35
0.0000190735 0.0000100136
Output for 5.4.28
0.0000231266 0.0000109673
Output for 5.4.27
0.0000329018 0.0000109673
Output for 5.4.6, 5.4.26
0.0000250340 0.0000121593
Output for 5.4.25
0.0000240803 0.0000410080
Output for 5.4.24
0.0000631809 0.0000100136
Output for 5.4.22
0.0000429153 0.0000100136
Output for 5.4.20
0.0000238419 0.0000109673
Output for 5.4.13, 5.4.19
0.0000240803 0.0000109673
Output for 5.4.18
0.0000419617 0.0000100136
Output for 5.4.14
0.0000231266 0.0000090599
Output for 5.4.10
0.0000219345 0.0000097752
Output for 5.4.9
0.0000250340 0.0000140667
Output for 5.4.7
0.0000350475 0.0000140667
Output for 5.4.5
0.0000231266 0.0000131130
Output for 5.4.3
0.0000228882 0.0000100136
Output for 5.4.1
0.0000240803 0.0000119209
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/3haGa 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/3haGa on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/3haGa on line 2
Process exited with code 255.