Count array values

The count( ) function is useful when you want to return how many elements are in your array. You can then use this in a for loop. Here’s an example we used earlier, only this time with the count function:

<?PHP

$seasons = array(“Autumn”, “Winter”, “Spring”, “Summer”);
$array_count = count($seasons);

print($array_count);

?>