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.... 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 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 } ?> Link to comment https://forums.phpfreaks.com/topic/43250-if-statement-break/#findComment-210000 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.