<?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);
preferences:
24.61 ms | 407 KiB | 5 Q