Correcting teacher:查无此人
Correction status:qualified
Teacher's comments:完成的不错。
<?php //$arr =10; //$arr ='apple'; //创建数组 $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' => '大兴区', ]; print_r( $arr2 ); echo '<hr>'; //数组的输出 //方括号里面写的是key 输出的是值 print_r( $arr2 ['10002']); echo '<hr>'; echo $arr2[ '10003' ]; echo '<hr>'; //多维数组 /*$arr3 = [ [ 'name' => '欧阳克', 'age' => "18岁", 'job' => '讲师', 'jineng' => [ 'php', 'html', 'js', ] ], [ 'name' => '西门', 'age' => "17岁", 'job' => '讲师', 'jineng' => [ 'php', 'html', 'js', ] ], [ 'name' => '朱老师', 'age' => "120岁", 'job' => '讲师', 'jineng' => [ 'php', 'html', 'js', ] ], ]; print_r( $arr3[1]['name']); echo '<hr>'; print_r($arr3[1]['jineng'][0]); echo '<hr>'; */ //php数组循环 //二维数组循环 $arr3 = [ [ 'name' => '欧阳克', 'age' => "18岁", 'job' => '讲师', 'jineng' => [ 'php', 'html', 'js', ] ], [ 'name' => '西门', 'age' => "17岁", 'job' => '讲师', 'jineng' => [ 'php', 'html', 'js', ] ], [ 'name' => '朱老师', 'age' => "120岁", 'job' => '讲师', 'jineng' => [ 'php', 'html', 'js', ] ], ]; 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>'; }