A

Admin • 828.03K Points
Coach

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 )
  • Correct Answer - Option(A)
  • Views: 7
  • Filed under category PHP
  • Hashtags:

Explanation by: Admin
array_reverse() returns the elements of an array in reverse order.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.