Counting the Number of Elements in an Array in PHP


Determine how many elements are in an array with count().

Source Code

$array = ["apple", "banana", "cherry"];
echo count($array); // Outputs: 3
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments