mishuk Posted March 18, 2007 Share Posted March 18, 2007 Can something be used in an if statement that works like a break; in a switch statement. I would like to exit the if statement and carry on with the rest of the script if a certain value is true e.g. if $var = 1 { exit if and carry on with script } else { [statement] } rest of script.... Quote Link to comment https://forums.phpfreaks.com/topic/43250-if-statement-break/ Share on other sites More sharing options...
papa_face Posted March 18, 2007 Share Posted March 18, 2007 You would just do: if ($var !== 1)//if its not 1 do something but then carry on with script if its is something other than 1 { } //rest of code Quote Link to comment https://forums.phpfreaks.com/topic/43250-if-statement-break/#findComment-209998 Share on other sites More sharing options...
cmgmyr Posted March 18, 2007 Share Posted March 18, 2007 or <?php if($var != 1){ //do something } ?> Quote Link to comment https://forums.phpfreaks.com/topic/43250-if-statement-break/#findComment-210000 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.