To count the number of elements in an array in PHP, you can use the count() function. Here is an example:
count()
$array = [1, 2, 3, 4, 5]; $count = count($array); echo $count;
This code will output 5, which is the number of elements in the array.
5