array创建一个数组!
查看数组内容:var_dump(数组变量);
一维数组:
复制
<?php $ywsz=array(1,2,3,4);?>
输出:
复制
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 )
多维数组:
复制
<?php $fruits = array ( "xx" => array("name" => "xiaoming", "shengao" => "165cm", "nianling" => "17"), "numbers" => array(1, 2, 3, 4, 5, 6), "chengji" => array("shuxue"=>"100", "yuwen" => "99", "yingyu"=>"0") ); ?>
输出结果:
复制
array(3) { ["xx"]=> array(3) {["name"]=> string(8) "xiaoming" ["shengao"]=> string(5) "165cm" ["nianling"]=> string(2) "17" } ["numbers"]=> array(6) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) [4]=> int(5) [5]=> int(6) } ["chengji"]=> array(3) { ["shuxue"]=> string(3) "100" ["yuwen"]=> string(2) "99" ["yingyu"]=> string(1) "0" } }
评论 (0)