I would like to stop my php code when a condition is not valid.
Example:
if (strlen($string) < 6){
echo "minimum 6"
}
if (strlen($string) > 32){
echo "maximum 32"
}
echo "success"
i would like stop the php code if the first condition is not met that it stops the script (so that it does not display success)
if I use die or exit it deletes the whole page, I just want to stop the script and leave the page as it is...
dieandexitare PHP keywords that cause the code to cease execution immediatelyso this code will do the following
This means that any unsent data in the output buffer will not be sent.
If you instead don't wish the process to end then you need to use conditional logic.