3v4l.org

run code in 300+ PHP versions simultaneously
<?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.2.0
0.0000109673 0.0000030994
Output for 7.1.7
0.0000100136 0.0000030994
Output for 7.1.6
0.0000140667 0.0000030994
Output for 5.4.9, 7.1.5
0.0000150204 0.0000050068
Output for 7.0.2 - 7.0.3, 7.1.0
0.0000071526 0.0000030994
Output for 7.0.20
0.0000269413 0.0000040531
Output for 7.0.8 - 7.0.14
0.0000078678 0.0000028610
Output for 7.0.7
0.0000078678 0.0000050068
Output for 7.0.0, 7.0.6
0.0000069141 0.0000028610
Output for 7.0.5
0.0000090599 0.0000028610
Output for 7.0.4
0.0000088215 0.0000081062
Output for 7.0.1
0.0000100136 0.0000040531
Output for 5.4.27, 5.6.28
0.0000181198 0.0000071526
Output for 5.4.3, 5.4.34, 5.6.1, 5.6.23
0.0000178814 0.0000069141
Output for 5.6.10, 5.6.22
0.0000190735 0.0000069141
Output for 5.5.2, 5.5.8, 5.5.21, 5.6.2, 5.6.21
0.0000190735 0.0000081062
Output for 5.4.2, 5.4.10, 5.4.36, 5.5.5, 5.6.16, 5.6.20
0.0000169277 0.0000069141
Output for 5.6.19
0.0000181198 0.0000069141
Output for 5.4.31, 5.6.18
0.0000178814 0.0000071526
Output for 5.6.17
0.0000250340 0.0000100136
Output for 5.6.11, 5.6.15
0.0000131130 0.0000050068
Output for 5.6.14
0.0000150204 0.0000090599
Output for 5.5.12, 5.6.5, 5.6.13
0.0000171661 0.0000069141
Output for 5.5.7, 5.5.29, 5.6.12
0.0000181198 0.0000081062
Output for 5.4.39, 5.6.8 - 5.6.9
0.0000147820 0.0000059605
Output for 5.4.11, 5.4.17, 5.5.1, 5.5.23, 5.5.31, 5.6.7
0.0000150204 0.0000059605
Output for 5.6.6
0.0000250340 0.0000069141
Output for 5.4.25, 5.6.4
0.0000150204 0.0000100136
Output for 5.4.32, 5.4.37, 5.6.3
0.0000159740 0.0000069141
Output for 5.4.12, 5.6.0
0.0000181198 0.0000100136
Output for 5.4.0, 5.4.41 - 5.4.42, 5.5.37
0.0000169277 0.0000081062
Output for 5.5.36
0.0000150204 0.0000088215
Output for 5.5.35
0.0000140667 0.0000059605
Output for 5.5.15, 5.5.34
0.0000178814 0.0000081062
Output for 5.5.33
0.0000200272 0.0000090599
Output for 5.5.32
0.0000190735 0.0000088215
Output for 5.5.30
0.0000178814 0.0000100136
Output for 5.5.28
0.0000150204 0.0000071526
Output for 5.5.27
0.0000119209 0.0000061989
Output for 5.5.26
0.0000209808 0.0000081062
Output for 5.5.25
0.0000209808 0.0000100136
Output for 5.5.24
0.0000200272 0.0000088215
Output for 5.5.22
0.0000231266 0.0000119209
Output for 5.4.35, 5.5.20
0.0000171661 0.0000071526
Output for 5.5.6, 5.5.19
0.0000181198 0.0000078678
Output for 5.4.23, 5.5.18
0.0000150204 0.0000069141
Output for 5.4.5, 5.5.0, 5.5.16
0.0000190735 0.0000078678
Output for 5.5.14
0.0000162125 0.0000071526
Output for 5.4.30, 5.5.13
0.0000200272 0.0000081062
Output for 5.4.1, 5.4.24, 5.5.11
0.0000169277 0.0000071526
Output for 5.5.10
0.0000169277 0.0000078678
Output for 5.5.9
0.0000200272 0.0000078678
Output for 5.5.4
0.0000197887 0.0000081062
Output for 5.5.3
0.0000259876 0.0000109673
Output for 5.4.45
0.0000140667 0.0000069141
Output for 5.4.44
0.0000219345 0.0000109673
Output for 5.4.43
0.0000219345 0.0000081062
Output for 5.4.18, 5.4.40
0.0000140667 0.0000050068
Output for 5.4.38
0.0000159740 0.0000061989
Output for 5.4.29
0.0000159740 0.0000100136
Output for 5.4.28
0.0000140667 0.0000081062
Output for 5.4.26
0.0000231266 0.0000100136
Output for 5.4.22
0.0000250340 0.0000050068
Output for 5.4.21
0.0000131130 0.0000059605
Output for 5.4.20
0.0000200272 0.0000121593
Output for 5.4.19
0.0000178814 0.0000119209
Output for 5.4.16
0.0000121593 0.0000050068
Output for 5.4.15
0.0000190735 0.0000100136
Output for 5.4.14
0.0000250340 0.0000109673
Output for 5.4.7, 5.4.13
0.0000159740 0.0000071526
Output for 5.4.8
0.0000188351 0.0000081062
Output for 5.4.6
0.0000247955 0.0000109673
Output for 5.4.4
0.0000188351 0.0000078678
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/kWkGN on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/kWkGN on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/kWkGN on line 2
Process exited with code 255.

preferences:
135.57 ms | 401 KiB | 211 Q