-
What will be the output of the following PHP code ?
<?php
$Str = array("Ajit" => "23", "Ats" => "21", "Aju" => "22");
ksort($Str);
foreach($Str as $s => $s_value)
{
echo "Key=" . $s . ", Value=" . $s_value;
echo "\n";
}
?>
-
- Error
- Nothing
- Key=Ajit, Value=23
Key=Aju, Value=22
Key=Ats, Value=21 - Key=Ajit, Value=23
Key=Ats, Value=21
Key=Aju, Value=22 - None of these
Correct Option: C
The ksort() function sorts an associative array in ascending order, according to the key.