--begin by itlife365
在PHP中如何得到数组的长度
php开发语言的便利性就是函数多,获取数组的长度
PHP中有两个内建的函数:count() 和sizeof(),可以实现得到数组的长度
$myFruitColorList = array("apple"=>"red", "grass"=>"green", "sky"=>"blue", "night"=>"black", "wall"=>"white");
echo "Array size with sizeof".sizeof($myFruitColorList);
echo "Array size with count: ".count($myFruitColorList);
输出的结果:
Array size with sizeof 5
Array size with count: 5
--edn by itlife365
how-to-get-array-length-on-php