How can we know the number of elements in an array using php?


Top Questions

Ans:
There are two ways:
1) sizeof($myarray) - This function is an alias of count()
2) count($array) - This function returns the number of elements in an array.

Note
if you just pass a simple variable instead of an array, count() will return 1.

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
3 + 6 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Check It !

Tweet It

W3 Updates

Stay informed on our latest news!

Syndicate content