What is tht arsort() function in php ?
The arsort() function sorts an associative array in descending order, as reported by the value.
why use arsort() function in php ?
arsort() is fundamentally used when sorting associative array in descending order, according to the value..
You can see below example of arsort() function in php.
<?php
$Getage=array("Joe"=>"28","Anthony"=>"35","Tori"=>"45");
//now call the asort() function for sorting associative array
arsort($Getage);
////loop rstart for find all value
foreach($Getage as $key=>$value)
{
echo "Name=" . $key . ", Age=" . $value;
echo "<br>";
}
?>
Output will come
Name=Tori, Age=45
Name=Anthony, Age=35
Name=Joe, Age=28
0 Comment(s)