Sometimes you may need to know how many elements an array is containing.
For example, you got result from a mysql query in an array. Now you want to show total number of results returned by the query.
There’s a function in php called count() which can do it for you very easily. Use the following in your favourite code editor:
<?php
$my_array = array("value1", "value2", "value3", "value4");
echo count($myarray);
?>
It will return 4.
