PHP Programing language

array_reverse() Function in PHP
Previous Home Next

array_reverse()

The array_reverse() function returns an array in the reverse order.

Syntax:
array_reverse(array,preserve)

 

In above syntax, "array" specifies an array and "preserve" specifies if the function should preserve the keys of the array or not and key values are as follows:

  • true
  • false

Example:

<?php
$arr=array("a"=>"Apple","b"=>"Mango","c"=>"Banana");
print_r(array_reverse($arr));
?>

Output:

Array ( [c] => Banana [b] => Mango [a] => Apple )

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: