燕十八公益PHP

来源:互联网 发布:it软件培训班 编辑:程序博客网 时间:2024/04/27 22:59

1.数字索引数组的创建方法

$stus = array("张三",“李四”,"王五");

 

$stus[] ="张三";

$stus[] ="李四";

$stus[] ="王五";

2.字符串索引数组的创建方法

$stu = array("name"=>"张三","age"=>23,"height"=>176);

 

$stu["name"] = "张三";

$stu["age"] = 23;

$stu["height"] = 176;

3.数组索引数组的遍历方法

for($i=0,$c=count($stus);$i<$c;$i++){

}

4.字符串索引数组的遍历方法

foreach($stu as $k => $v){

}