-1

How to do a "for each" from the end of an array in PHP ?

The end function can only return me one element http://php.net/manual/fr/function.end.php

Community
  • 1
  • 1
goldiman
  • 189
  • 2
  • 13

1 Answers1

4

Reverse the array and do a normal foreach?

$newArray = array_reverse($array);
foreach ($newArray as $key => $value) {
   ...
}
Blizz
  • 8,082
  • 2
  • 33
  • 53