The question is simple. I have a foreach
loop in my code:
foreach($array as $element) {
//code
}
In this loop, I want to react differently when we are in first or last iteration.
How to do this?
转载于:https://stackoverflow.com/questions/1070244/how-to-determine-the-first-and-last-iteration-in-a-foreach-loop