In php the sizeof() Function returns the number of elements in an array.
Syntax
sizeof(array,mode);
The argument array specifies the array and the mode specifies whether to count multidimensional array or not
the value 0 specifies do not count all elements of multidimensional arrays where as 1 specifies count all elements of multidimensional arrays.
For example
<?php
$fruits=array
(
"apple"=>array
(
"Red"
),
"grapes"=>array
(
"green"
),
"orange"=>array
(
"orange"
)
);
echo "Normal count: " . sizeof($fruits)."<br>";
echo "Recursive count: " . sizeof($fruits,1);
?>
output
Normal count: 3
Recursive count: 8
0 Comment(s)