arsort

It sort an array in reverse order and maintain index association

Example

<?php
echo “<pre>”;
$array = array(‘PHP’,’ ASP’, ‘JS’,’AS’);
arsort($array);
print_r($array);
?>

Output

Array
(
[0] => PHP
[2] => JS
[3] => AS
[1] =>  ASP
)

Share