Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following PHP code?
<?php
$fruits = array (“apple”, “orange”, array (“pear”, “mango”),
“banana”);
echo (count($fruits, 1));
?>

What will be the output of the following PHP code?
<?php
$fruits = array (“apple”, “orange”, array (“pear”, “mango”),
“banana”);
echo (count($fruits, 1));
?>
a) 3
b) 4
c) 5
d) 6

Answer: d
Explanation: The function count() will return the number of elements in an array. The parameter 1 counts the array recursively i.e it will count all the elements of multidimensional arrays.

Join The Discussion