Blogger Information
Blog 14
fans 0
comment 0
visits 8326
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP基本语法-数组 - PHP培训九期线上班
海涛
Original
508 people have browsed it
  1. 创建数组


  2. 关联数组、索引数组


  3. 访问数组的数据


  4. 二维数组、三维数组


  5. 二维数组循环,三维数组循环

  6. 实例

    <?php
    $arr = array(
        array(
            'name' => '张三',
            'age' => 18,
            'hobby' => ['打球','跑步']
        ),
        array(
            'name' => '李四',
            'age' => 17,
            'hobby' => ['看书','游泳']
        ),
    );
    
    foreach ( $arr as $var) {
        echo '姓名:'. $var['name']. '<br>';
        echo '年龄:'. $var['age']. '<br>';
        echo '爱好:';
        foreach ($var['hobby'] as $var2){
            echo $var2. '、';
        }
        echo '<hr>';
    }

    运行实例 »

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

    image.png

image.png

image.png

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
Author's latest blog post