Mạnh Cường
Member
What will be the output of the following PHP code?
A.
Key = Harry, Value = 21
Key = Ron, Value = 21
Key = Malfoy, Value = 23
B.
Key = Harry, Value = 21
Key = Ron, Value = 19
Key = Malfoy, Value = 23
C.
Key = Harry, Value = 21
Key = Malfoy, Value = 23
Key = Ron, Value = 19
D.
Key = Ron, Value = 19
Key = Harry, Value = 21
Key = Malfoy, Value = 23
Code:
<?php
$age = array("Harry" => "21", "Ron" => "19", "Malfoy" => "23");
ksort($age);
foreach($age as $x => $x_value)
{
echo "Key=" . $x . ", Value=" . $x_value;
echo "<br>";
}
?>
Key = Harry, Value = 21
Key = Ron, Value = 21
Key = Malfoy, Value = 23
B.
Key = Harry, Value = 21
Key = Ron, Value = 19
Key = Malfoy, Value = 23
C.
Key = Harry, Value = 21
Key = Malfoy, Value = 23
Key = Ron, Value = 19
D.
Key = Ron, Value = 19
Key = Harry, Value = 21
Key = Malfoy, Value = 23