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
if its numerically indexed:
foreach ($foo as $key=>$var){ if($var==$foo[$key+1]){ echo 'current and next var are the same'; } }