You can use the PHP function count(). It returns the number of elements in an array.
Here is an example:
<?php$arr=array("apple", "banana", "cat", "dog");echo count($arr);?>
The above code will return 4.