What will be the output of the following PHP code?
<?php
$arr = array ("picture1.JPG", "picture2.jpg", "Picture10.jpg", "picture20.jpg");
sort($arr);
print_r($arr);
?>
<?php
$arr = array ("picture1.JPG", "picture2.jpg", "Picture10.jpg", "picture20.jpg");
sort($arr);
print_r($arr);
?>
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 )
D. Array ( [0] => Picture10.jpg [1] => picture1.JPG [2] => picture20.jpg [3] => picture2.jpg )
Answer: Option C
Solution(By Examveda Team)
While sorting each character is compared with the others and sorted using ascii values therefore we the sorted array to be like option c.Related Questions on Arrays
A. karnataka 11,35,000
B. 11,35,000
C. population 11,35,000
D. karnataka population
Which function will return true if a variable is an array or false if it is not?
A. this_array()
B. is_array()
C. do_array()
D. in_array()
Join The Discussion