-
What will be the output of the following PHP code?
<?php
$str = array ("Rahul", "Ajit", "Aju", "Ats");
sort($str);
print_r($str);
?>
-
-
Array
(
[2] => Ats
[3] => Rahul
) -
Array
(
[0] => Ajit
[1] => Aju
) -
Array
(
[0] => Ajit
[1] => Aju
[2] => Ats
[3] => Rahul
) -
Array
(
[1] => Aju
[2] => Ats
) - None of these
-
Correct Option: C
While sorting each character is compared with the others and sorted using ascii values therefore we the sorted array to be like option c.