fork download
  1. <?php
  2.  
  3. $a1 = ['a', 'b', 'c', 'd'];
  4. $a2 = [1, 2, 3, 4];
  5. $a3 = [];
  6. for($i = 0, $size = count($a1); $i < $size; $i++) {
  7. $a3[] = $a1[$i];
  8. $a3[] = $a2[$i];
  9. }
  10. print_r($a3);
Success #stdin #stdout 0.02s 82880KB
stdin
Standard input is empty
stdout
Array
(
    [0] => a
    [1] => 1
    [2] => b
    [3] => 2
    [4] => c
    [5] => 3
    [6] => d
    [7] => 4
)