asort

It sort an array and maintain index association

Example

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

Output

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

Share