fork(4) download
  1. <?php
  2.  
  3. $a = [[4, 3, 2, 1], [5, 6, 7, 8], [12, 11, 10, 9], [13, 14, 15, 16]];
  4.  
  5. function f($a){foreach($a as$v)$r[]=$_++&1?$v:array_reverse($v);return array_merge(...$r);}
  6.  
  7. print_r(f($a));
Success #stdin #stdout #stderr 0.01s 82560KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 4
    [4] => 5
    [5] => 6
    [6] => 7
    [7] => 8
    [8] => 9
    [9] => 10
    [10] => 11
    [11] => 12
    [12] => 13
    [13] => 14
    [14] => 15
    [15] => 16
)
stderr
PHP Notice:  Undefined variable: _ in /home/YPcFbh/prog.php on line 5