Definition and Usage
The count() function returns the number of elements in an array.Syntax
count(array,mode);
| Parameter | Description |
|---|---|
| array | Required. Specifies the array |
| mode | Optional. Specifies the mode. Possible values:
|
Example
Return the number of elements in an array:
<?php
$cars=array("Volvo","BMW","Toyota");
echo count($cars);
?>
$cars=array("Volvo","BMW","Toyota");
echo count($cars);
?>
OUTPUT :