- 1

$letters = array(array("a","b")); echo (count($letters,1));

What is the output and how?

20th Oct 2021, 2:39 AM
Rohit Ahuja
Rohit Ahuja - avatar
2 odpowiedzi
+ 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.
20th Oct 2021, 3:04 AM
Ipang
+ 1
Thnku so much
20th Oct 2021, 5:53 PM
Rohit Ahuja
Rohit Ahuja - avatar