Correcting teacher:查无此人
Correction status:qualified
Teacher's comments:完成的不错。
<?php $arr1 = array(); var_dump( $arr1); echo '<hr>'; $arr2 = []; var_dump($arr2); echo '<hr>'; //索引数组 $arr = [ 10, 11, '淡月酱', '不甜的淡月', 12.9, null ]; //打印数组 print_r( $arr ); echo '<hr>'; //关联数组 $arr2 = [ '10001' => '黄埔区', '10002' => '杨浦区', '10003' => '徐汇区', '10004' => '长宁区', '10005' => '浦东新区', ]; print_r( $arr2 ); echo '<hr>'; //数组的输出 //方括号里面写的是key 输出的是值 print_r( $arr2 ['10002']); echo '<hr>'; echo $arr2[ '10003' ]; echo '<hr>'; //多维数组 $arr3 = [ [ 'name' => '淡月酱', 'age' => "22岁", 'job' => '学生', 'jineng' => [ '吃饭', '睡觉', '写代码', ] ], [ 'name' => '溪上花间', 'age' => "22岁", 'job' => '学生', 'jineng' => [ '吃饭', '睡觉', '打豆豆', ] ], [ 'name' => '小小挽歌', 'age' => "21岁", 'job' => '社畜', 'jineng' => [ '吃饭', '睡觉', '上班', ] ], ]; foreach ( $arr3 as $v ){ //print_r($v['name'] ); echo '<hr>'; echo '姓名:' .$v['name'] .'---'; echo '年龄:' .$v['age'] .'---'; echo '职业:' .$v['job'] .'---'; echo '技能:'; foreach ($v ['jineng'] as $vv) echo $vv.'-'; echo '<hr>'; }