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 (“mango”, “apple”, “pear”, “peach”);
$fruits = array_flip($fruits);
echo ($fruits[0]);
?>

What will be the output of the following PHP code?
<?php
$fruits = array (“mango”, “apple”, “pear”, “peach”);
$fruits = array_flip($fruits);
echo ($fruits[0]);
?>
a) mango
b) error
c) peach
d) 0

Answer: b
Explanation: As we are flipping the values, $fruits[“mango”] = 0, $fruits[“apple”] = 1 and so on.

Join The Discussion