PHP中如何得到数组的长度

PHP中有两个内建的函数:count()sizeof(),可以实现得到数组的长度

 

$colorList = array("apple"=>"red",                   "grass"=>"green",                   "sky"=>"blue",                   "night"=>"black",                   "wall"=>"white");
 echo "Array size with count: ".count($colorList);

  

 

你可能感兴趣的:(apple,PHP)