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" } }
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/241349.html