The question is simple. I have a foreach loop in my code:
foreach
foreach($array as $element) { //code }
In this loop, I want to r
An attempt to find the first would be:
$first = true; foreach ( $obj as $value ) { if ( $first ) { // do something $first = false; //in order not to get into the if statement for the next loops } else { // do something else for all loops except the first } }