PHP基础

1、定义并输出一个二维数组:

 $testArray=array(
         "0"=>array(
             "id"=>1,
             "name"=>"Lucy",
             "sex"=>"girl",
             "age"=>14
         ),
         "1"=>array(
             "id"=>1,
             "name"=>"Abalm",
             "sex"=>"boy",
             "age"=>18
         ),
         "2"=>array(
             "id"=>1,
             "name"=>"Tom",
             "sex"=>"boy",
             "age"=>13
         ),
     );
foreach($testArray as $key=>$value){
 foreach($value as $key=>$value){
    echo $key.":".$value. "</br>";
 }
}


你可能感兴趣的:(PHP基础)