fork download
  1. <?php
  2. /**
  3.  * Для вопроса http://ru.stackoverflow.com/questions/432181/
  4.  */
  5. $x = array(12, 16, 18);
  6. $y = array(22, 26, 28, 42, 52, 62);
  7. $z = array(32, 36, 38, 44, 55);
  8. $xyz = array();
  9. for ($i = 0; $i < max( count($x), count($y), count($z)); $i++) {
  10. if( isset( $x[$i])) $xyz[] = $x[$i];
  11. if( isset( $y[$i])) $xyz[] = $y[$i];
  12. if( isset( $z[$i])) $xyz[] = $z[$i];
  13. }
  14. print_r($xyz);
Success #stdin #stdout 0.02s 24400KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 12
    [1] => 22
    [2] => 32
    [3] => 16
    [4] => 26
    [5] => 36
    [6] => 18
    [7] => 28
    [8] => 38
    [9] => 42
    [10] => 44
    [11] => 52
    [12] => 55
    [13] => 62
)