PHP multidimensional array traversal, as shown in the figure
菜鸟
菜鸟 2019-04-21 01:22:55
0
1
1070
<?php
$arr=array(
    '教学部'=>array(
        array('李某','18','人妖'),
        array('高某','20','男'),
        array('张某','21','妖人'),
    ),
    '宣传部'=>array(
        array('李某','18','人妖'),
        array('高某','20','男'),
        array('张某','21','妖人'),
    ),
    '财务部'=>array(
        array('李某','18','人妖'),
        array('高某','20','男'),
        array('张某','21','妖人'),
    ),
);
foreach($arr as $value){
    foreach($value as $a=>$b){
        echo "$a---$b</br>";
    }
    echo '------</br>';
}
?>

canvas.png

菜鸟
菜鸟

reply all(1)
Alone88

This is a three-dimensional array. What you get after traversing the second time is still an array. You need to print_r to print it, or add another traversal inside it

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!