To reverse the items in an array you have two methods of achieving this
array_reverse()
$array = [1,2,3,4,5,6,7,8,9]; $rev = array_reverse($array); foreach($rev as $val) { print $val; }
end() & prev() rewind
$array = [1,2,3,4,5,6,7,8,9]; print end($array); while($val = prev($array)) { print $val; }
will both print:
987654321