Blogger Information
Blog 34
fans 2
comment 0
visits 23178
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP基础——PHP数组
遗忘了寂寞
Original
596 people have browsed it

实例

$arr = array(
    array(
        'name' => '欧阳克',
        'age'  => 18,
    ),
    array(
        'name' => '黄蓉',
        'age'  => 16,
    ),
    array(
        'name' => '郭靖',
        'age'  => 22,
    )
)
var_dump($arr);
print_r($arr);

运行实例 »

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

实例

$arr = [
    [
        'name' => '欧阳克',
        'age'  => 18,
        'gongfu' => [
            '神驼雪山拳',
            '灵蛇拳法'
        ]
    ],
    [
        'name' => '黄蓉',
        'age'  => 16,,
        'gongfu' => [
            '碧波掌法',
            '落英神剑掌'
        ]
    ],
    [
        'name' => '郭靖',
        'age'  => 22,,
        'gongfu' => [
            '降龙十八掌',
            '九阴真经'
        ]
    ]
];
var_dump($arr);
print_r($arr);

运行实例 »

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


实例

$arr = [
    [
        'name' => '欧阳克',
        'age'  => 18
    ],
    [
        'name' => '黄蓉',
        'age'  => 16
    ],
    [
        'name' => '郭靖',
        'age'  => 22
    ]
];
foreach( $arr as $k=>$v ){
    foreach ($v as $key => $value) {
        echo $value;
        echo '<hr>';
    }
}

运行实例 »

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

实例

$arr = [
    [
        'name' => '欧阳克',
        'age'  => 18
    ],
    [
        'name' => '黄蓉',
        'age'  => 16
    ],
    [
        'name' => '郭靖',
        'age'  => 22
    ]
];
foreach( $arr as $k=>$v ){
    echo $v['name'].' --- '.$v['age'];
    echo '<hr>';
}

运行实例 »

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


实例

$arr = [
    ['name' => '欧阳克','age'  => 18,'gongfu' => ['神驼雪山拳','灵蛇拳法']],
    ['name' => '黄蓉','age'  => 16,'gongfu' => ['碧波掌法','落英神剑掌']],
    ['name' => '郭靖','age'  => 22,'gongfu' => ['降龙十八掌','九阴真经']]
];
foreach($arr as $v){
	echo $v['name'] . '---' .$v['age'] . '---';
	foreach($v['gongfu'] as $vv){
		echo $vv. '--';
	}
	echo '<br>';
}

运行实例 »

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


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