if you want to sort according to values in desc order
$finalprint[] = "XYZ";
$finalprint[] = "ABC";
$finalprint[] = "MNO";
rsort($finalprint);
foreach ($finalprint as $val) {
echo $val." " ;
}
o/p XYZ MNO ABC
if you want to sort according to keys in desc order
krsort($finalprint);
foreach ($finalprint as $val) {
echo $val." " ;
}
o/p MNO ABC XYZ
0
solved Print array values