Q. What will the following code print?

Code:
<?php
$array = [1, 2, 3];
print_r(array_reverse($array));
?>
  • (A) Array ( [0] => 3 [1] => 2 [2] => 1 )
  • (B) Array ( [0] => 1 [1] => 2 [2] => 3 )
  • (C) Error
  • (D) Array ( [0] => 2 [1] => 3 [2] => 1 )
πŸ’¬ Discuss
βœ… Correct Answer: (A) Array ( [0] => 3 [1] => 2 [2] => 1 )
Explanation: array_reverse() returns the elements of an array in reverse order.
Explanation by: Rati Dubey
array_reverse() returns the elements of an array in reverse order.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
85
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Rati Dubey
Publisher
πŸ“ˆ
82%
Success Rate