order an array from max to min php code example
Example: array sort php
<?php
$fruits = array("lemon", "orange", "banana", "apple");
sort($fruits);
foreach ($fruits as $key => $val) {
echo $val;
}
/*
OUTPUT:
apple
banana
lemon
orange
*/
?>
<?php
$fruits = array("lemon", "orange", "banana", "apple");
sort($fruits);
foreach ($fruits as $key => $val) {
echo $val;
}
/*
OUTPUT:
apple
banana
lemon
orange
*/
?>