count()
count - Count all elements in an array, or properties in an object
Syntax
int count (
mixed $var,
int $mode)
Arguments
- var - The array.
- mode - If the optional mode parameter is set to COUNT_RECURSIVE (or 1), count() will recursively count the array. This is particularly useful for counting all the elements of a multidimensional array. count() does not detect infinite recursion.
Description
Counts all elements in an array, or properties in an object.
Version
PHP 4, 5
Return value
Returns the number of elements in var, which is typically an array, since anything else will have one element.