<?php
$myArrays = array(
array(1, 2, 3, 4),
array(5, 6, 7, 8),
array(9, 10, 11, 12),
array(13, 14, 15, 16)
);
$index = 0;
$myArrays = array_map(function ($v) use (&$index, $myArrays) {
if (($index % 2) != 0) {
echo implode("\n", array_reverse(array_column($myArrays, $index))) . "\n";
} else {
echo implode("\n", array_column($myArrays, $index)) . "\n";
}
$index++;
}, $myArrays);
- Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.5 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
- 1
5
9
13
14
10
6
2
3
7
11
15
16
12
8
4
preferences:
115.91 ms | 404 KiB | 200 Q