-
What will be the output of the following PHP code?
<?php
$subject = array('a' => 'Math', 'b' => 'Science', 'c'=> 'Geography');
asort($subject);
foreach ($subject as $key => $val)
{
echo "$key = $val";
echo "\n";
}
?>
-
- Error
- c = Geography
a = Math
b = Science - Nothing
- a = Math
b = Science
c = Geography - None of these
Correct Option: B
The function asort() sorts the array in ascending order, except that the key/value corresponding is maintained.