3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myArrays = array( array(1, 2, 3, 4), array(5, 6, 7, 8), array(9, 10, 11, 12), array(13, 14, 15, 16) ); foreach ($myArrays as $index => $myArray) { if (($index % 2) != 0) { echo implode("\n", array_reverse(array_column($myArrays, $index))) . "\n"; } else { echo implode("\n", array_column($myArrays, $index)) . "\n"; } }

preferences:
26.06 ms | 406 KiB | 5 Q