Find the last element of an array while using a foreach loop in PHP - Stack Overflow
If you need to do something for every element except either the first or the last and only if there is more than one element in the array, I prefer the following solution. I know there are many solutions above and posted months/one year before mine, but t...