What will be the output of the following PHP code?
<?php
$fruits = array ("mango", "apple", "pear", "peach");
$fruits = array_flip($fruits);
echo ($fruits[0]);
?>
<?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.Related Questions on Arrays
A. karnataka 11,35,000
B. 11,35,000
C. population 11,35,000
D. karnataka population
Which function will return true if a variable is an array or false if it is not?
A. this_array()
B. is_array()
C. do_array()
D. in_array()
Join The Discussion