The Get array length function in PHP has two count () and sizeof (), if the array passed to the function is an empty array, or a variable that is not set, the number of elements returned is 0;
Like the function of two functions, the manual says that sizeof () is the alias of the function count ().
Count (Array,mode), count () function two parameters, array is required, mode indicates whether recursion is required to calculate the number of elements in the array, is not required, default is 0. That is not required. When array is a one-dimensional array, mode is not used, and when array is a multidimensional array, mode is 0, the number of first-level arrays is computed, mode is 1, and the number of all arrays is computed. For example, array $cars,count ($cars) = 3;count ($car, 1) =3+5=8.
$cars =array (" Volvo" =>array (" XC60", "XC90" ), "BMW" =>array ( "X3", "X5" ), "Toyota" =>array ( "Highlander") );
Count () and sizeof () in PHP