The php count() function returns the number of elements in an array.
<?php
$cars=array("Volvo","BMW","Toyota");
echo count($cars);
?>
Syntax
count(array, mode)
Parameter Values
| Parameter | Description |
|---|---|
| array | Required. Specifies the array |
| mode | Optional. Specifies the mode. Possible values:0 – Default. Does not count all elements of multidimensional arrays1 – Counts the array recursively (counts all the elements of multidimensional arrays) |
