0

PHP: Can anyone explain that code?

$letters = array ("a", "b", array("c", "d"), "e"); echo (count($letters, 1)); The output is 6, but why? I know the count() function but don't know what the second parameter (in this case 1) does. Can someone explain?

12th Jul 2019, 5:42 PM
Niklas
3 Answers
+ 2
the 1 will probably be the position of element that should be printed
12th Jul 2019, 5:58 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 2
The second (optional) parameter is set to 1, so count() will count recursively. https://www.php.net/manual/en/function.count.php
12th Jul 2019, 7:02 PM
Johann
Johann - avatar
0
*AsterisK* position of an element of the array?
12th Jul 2019, 6:13 PM
Niklas