Vidyalelo
PHP · Q38

Arrays

Programming · PHP · question 38

Q38

What will be the output of the following PHP code?

A.
Array ( [0] => picture1.JPG [1] => Picture10.jpg [2] => picture2.jpg [3] => picture20.jpg )
B.
Array ( [0] => picture1.JPG [1] => picture2.jpg [2] => Picture10.jpg [3] => picture20.jpg )
C.
Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture2.jpg [3] => picture20.jpg )
Answer
D.
Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture20.jpg [3] => picture2.jpg )

Answer: Option C

Solution

Answer: Option C
Solution:
While sorting each character is compared with the others and sorted using ascii values therefore we the sorted array to be like option c.