PHP - Foreach,将阵列打印在一起

时间:2016-06-14 09:02:44

标签: php

$aSpelers = array('Cilessen', 'Janmaat', 'de Vrij' , 'Vlaar', 'Blind', 'de Jong', 'Sneijder');

$aRugnummers = array(1, 7, 3, 2, 5,8, 10 );

$Posities = array('doel', 'verdediging', 'verdediging', 'verdediging', 'verdediging','middenveld','middenveld');

FOREACH()

1 个答案:

答案 0 :(得分:0)

我不清楚你想要什么。我想你想要像下面的代码。

$arr[] = array('Cilessen', 'Janmaat', 'de Vrij' , 'Vlaar', 'Blind', 'de Jong', 'Sneijder');
    $arr[] = array(1, 7, 3, 2, 5,8, 10 );
    $arr[] = array('doel', 'verdediging', 'verdediging', 'verdediging', 'verdediging','middenveld','middenveld');
    foreach($arr as $array){        
        if(is_array($array)){
            foreach($array as $key=>$value){
                echo $value.'<br>';
            }
            echo '<br>';
        }       
    }