how to code php sort specific code example
Example 1: sort array php
<?php
$fruits = array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple");
asort($fruits);
foreach ($fruits as $key => $val) {
echo "$key = $val\n";
}
?>
//Would output:
c = apple
b = banana
d = lemon
a = orange
Example 2: php sort hight to low
$letters=array("b","a","c");
arsort($letters); //referse sort an array ("c","a","b")