Finding the Length of an Array in PHP


Use count() to find out how many elements are in an array.

Source Code

$fruits = ['Apple', 'Banana', 'Cherry'];
echo "There are " . count($fruits) . " fruits in the array.";
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments