PHP 数组元素个数计算方法:count() 和 sizeof() 函数
可以使用 PHP 内置函数 count() 来计算数组元素个数。例如:
$array = array('apple', 'banana', 'orange');
$count = count($array);
echo $count; // 输出 3
也可以使用 sizeof() 函数来计算,它和 count() 函数的功能是一样的。例如:
$array = array('apple', 'banana', 'orange');
$count = sizeof($array);
echo $count; // 输出 3
原文地址: https://www.cveoy.top/t/topic/kpA2 著作权归作者所有。请勿转载和采集!