Is there an SPL Reverse array iterator in PHP? And if not, what would be the best way to achieve it?
I could simply do
$array = array_reverse($array)
Note that if you want to preserve the keys of the array, you must pass true as the second parameter to array_reverse:
true
array_reverse
$array = array_reverse($array, true); foreach ($array as $currentElement) { // do something here }