Examveda
Examveda

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: Option B

Solution(By Examveda Team)

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

This Question Belongs to PHP >> Arrays

Join The Discussion

Related Questions on Arrays