php数组迭代多个数组

时间:2016-03-12 14:43:29

标签: php arrays

嗨我下面列出了4个数组。可以告诉我如何打印每个数组的0和3个索引值。

Array
(
    [0] => 7406072674
    [1] => 
    [2] => 
    [3] => Dear Student,  FlipTutor has credited 10 FREE coins. Connect with expert teacher and clear your doubts. Install App - http://bit.ly/1WIaNKD
    [4] => 139
    [5] => 0
)
Array
(
    [0] => 7676731030
    [1] => hkjhk
    [2] => hgk
    [3] => Dear Nishant, FlipTutor has credited 10 FREE coins. Connect with expert teacher and clear your doubts. Install App - http://bit.ly/1WIaNKD
    [4] => 138
    [5] => 0
)
Array
(
    [0] => 9738040711
    [1] => ljlhkhjk
    [2] => khgkj
    [3] => Dear Sonu, FlipTutor has credited 10 FREE coins. Connect with expert teacher and clear your doubts. Install App - http://bit.ly/1WIaNKD
    [4] => 135
    [5] => 0
)
Array
(
    [0] => 9949942011
    [1] => anil
    [2] => sdfsd
    [3] => Dear Anil, FlipTutor has credited 10 FREE coins. Connect with expert teacher and clear your doubts. Install App - http://bit.ly/1WIaNKD
    [4] => 123
    [5] => 1
)

1 个答案:

答案 0 :(得分:1)

$arrays = "YOUR 4 ARRAYS";

foreach ($arrays as $array) {
    $newArray[]=$array[0];
    $newArray[]=$array[3];
}

var_dump($newArray);