|
|
PHP Array Elements Count Function
|
Tutorials » Php »
|
Topic |
What is count Function?
|
|
Explanation |
|
The "count" function counts all the elements in an array, or properties in an object.
Syntax:
count(array,mode)
In the above syntax "array" is the array from which to get the count of elements,"mode" is optional,which can have "0" or "1". If its "0" it will not detect
a multidimensional array,if its "1" it will detect a multidimensional array.
Example:
<?php
$b=array("Grapes","Apple","Cherry");
count($b);
print_r($b);
?>
Result:
3
In the above example the total count of an array elements is calculated and displayed.
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|