I have a foreach loop and I want to see if there is a next element in the loop so I can compare the current element with the next. How can I do this? I\'ve read about the cu
You could probably use while loop instead of foreach:
while ($current = current($array) ) { $next = next($array); if (false !== $next && $next == $current) { //do something with $current } }