exit from a loop

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rajivkrishnang
Forum Newbie
Posts: 5
Joined: Tue Mar 23, 2004 12:18 am

exit from a loop

Post by rajivkrishnang »

for($i=1;$i<=$p_rowcount;$i++)
{
eval("\$model=\$p_model$i;");

if(model != "---select---")
exit(); // here i want to exit form the 'for' loop and like to use the current value of model;
}




anyone to help me pls...........
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post by Wayne »

Code: Select all

for($i=1;$i<=$p_rowcount;$i++) { 
    eval("\$model=\$p_model$i;"); 
    if($model != "---select---") 
        break;
    } 
}
Post Reply