实例
$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>'; }
运行实例 »
点击 "运行实例" 按钮查看在线实例