Blogger Information
Blog 19
fans 0
comment 0
visits 13568
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
数组及数组循环-第九期(191113作业)
feng
Original
627 people have browsed it

实例

<?php
$arr2=array(
    'a'=>'我是A',
    'b'=>'我是B',
    'c'=>'我是C'
);
print_r($arr2);
echo '<hr>';
$arr1=['我是A','我是B','我是C'];
print_r($arr1);
echo '<hr>';
echo '索引数组的第二个元素是:'.$arr1[2];
echo '<hr>';
echo '关联数组的第三个元素是:'.$arr2['c'];
echo '<hr>';
$arr3=[
    ['我是A','我是B','我是C'],
    ['我是AA','我是BB','我是CC'],
    ['我是AAA','我是BBB','我是CCC']
];
foreach ($arr3 as $item => $value) {
    echo '第'.$item.'行的值为:'.$value[0].'.'.$value[1].'.'.$value[2];
    echo '<br>';
}
echo '<hr>';
$arr4=array(
    array(
        array('我是A','我是B','我是C'),
        array('我是AA','我是BB','我是CC'),
        array('我是AAA','我是BBB','我是CCC')
    )
);
print_r($arr4);
echo '<hr>';
foreach ($arr4 as $v){
    foreach ($v as $v1){
        echo $v1[0].'.'.$v1[1].'.'.$v1[2];
        echo '<br>';
    }
}

运行实例 »

点击 "运行实例" 按钮查看在线实例

demo.png


手抄:

手抄.jpg

Correcting teacher:查无此人查无此人

Correction status:qualified

Teacher's comments:完成的不错。
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments