- 1
$letters = array(array("a","b")); echo (count($letters,1));
What is the output and how?
2 ответов
+ 1
Quoting from https://www.php.net/manual/en/function.count.php
"mode
If the optional mode parameter is set to COUNT_RECURSIVE (or 1), count() will recursively count the array. This is particularly useful for counting all the elements of a multidimensional array."
For the array in your example, you will get 3 from count() because the inner array plus its 2 elements are counted in.
+ 1
Thnku so much