Blogger Information
Blog 13
fans 1
comment 0
visits 8052
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
第十三天数组和数组循环
云外
Original
621 people have browsed it

创建数组

$arr =array ();

$arr= [];

创建索引数组

$arr = [

'欧阳大仙',

'法力无边',

'武功盖世',

]

访问输出

echo $arr[0];

echo $arr[1];

echo $arr[2];

创建关联数组

$arr = [

'oy' =>'欧阳大仙',

'fl' =>'法力无边',

'wg' =>'武功盖世',

]

访问输出

echo $arr['oy'];

echo $arr['oy'];

echo $arr['oy'];

二维数组

$arr = array (

$arr = array (

'oy' =>'欧阳大仙',

'fl' =>'法力无边',

'wg' =>'武功盖世',

)

//变三维

'js; =>[

'举世无双',

'一统江湖',

]

)

多维数组循环

foreach ($arr as $key => $v){

foreach ( $v as $key => $value) {

echo $value

echo '<hr>'

}

}

foreach ($arr as $key => $v ){

foreach ($v['js'] as $vv ){

echo $vv ;

}

}

php2.JPG

 

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