How to get length of an array in php?
4 answer(s)
Answer # 1 #
For multidimensional arrays, count($array, COUNT_RECURSIVE)
can count all elements including nested arrays.
Answer # 2 #
Use the built-in count()
function: $length = count($array);
This returns the number of elements in the array.