andyw27
asked on
Using break within a if statement ?
I know you can use break statements with switch statements, however is it acceptable to use break statements within if statements ?
Many thanks.
Many thanks.
if ($something) {
do this.
exit; <--- this is what you want
}
that will exit the entire script.
do this.
exit; <--- this is what you want
}
that will exit the entire script.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Break is used in loops and switches, not conditional statements. Doing so results in a fatal error.
if your intentions are to stop the script entirely,I would use EXIT() from within this IF statement. This is acceptable.
If I am off base here, someone let me know.