lundi 21 novembre 2016

How to Execute "else" inside for loop after the completion of iteration

I have a for loop inside which i'm putting if else. I want to check if for every for loop condition and if it is false after iteration i want to execute else. How am i supposed to achieve this.

Sample

foreach($student as $x){

if($x[a] >= $x[b] ){
   { execute this }
} else {
this should run at the last loop 
}
}

A Help much appreciated

Aucun commentaire:

Enregistrer un commentaire