取出关联数组的key值,可用 array_keys()取出;
1 <?php 2 $a=array("Volvo"=>"XC90","BMW"=>"X5","Toyota"=>"Highlander"); 3 print_r(array_keys($a)); 4 ?>
输出结果
1 Array ( [0] => Volvo [1] => BMW [2] => Toyota )
取出关联数组的values值,可用 array_values()取出;
1 <?php 2 $a=array("Name"=>"Bill","Age"=>"60","Country"=>"USA"); 3 print_r(array_values($a)); 4 ?>
输出结果
1 Array ( [0] => Bill [1] => 60 [2] => USA )