What will be the output of the following PHP code?
<?php
$fruits = array ("mango", "apple", "peach", "pear");
$fruits = asort ($fruits);
printr ($fruits);
?>
<?php
$fruits = array ("mango", "apple", "peach", "pear");
$fruits = asort ($fruits);
printr ($fruits);
?>
A. Array ( [1] => apple [0] => mango [2] => peach [3] => pear )
B. Array ( [0] => apple [1] => mango [2] => peach [3] => pear )
C. Error
D. Array ( [1] => apple [0] => mango [3] => peach [2] => pear )
Answer: Option A
Solution(By Examveda Team)
The function asort() sorts the array in ascending order, except that the key/value corresponding is maintained.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