| Previous | Home | Next |
array_sizeof()
The sizeof() function returns the number of elements in an array.
Syntax:sizeof(array,mode);
In above syntax, "array" specifies the array, "mode" specifies the mode and values are as follows:
- 0: Default. Does not count all elements of multidimensional arrays
- 1: Counts the array recursively (counts all the elements of multidimensional arrays)
Example:
<?php
$fruits=array("Apple","Mango","Orange","Banana");
echo sizeof($fruits);
?>
Output:
array_count()
The count() function returns the number of elements in an array.
Syntax:In above syntax, "array" specifies the array, "mode" specifies the mode and values are as follows:
- 0: Default. Does not count all elements of multidimensional arrays
- 1: Counts the array recursively (counts all the elements of multidimensional arrays)
Example:
<?php
$fruits=array("Apple","Mango","Orange","Banana");
echo count($fruits);
?>
Output:
| Previous | Home | Next |