DiigIT | IT Community
No Profile Image
Welcome Guest
New User? Register | Login

How To Stop Script?

By: Manoj | 02 Jan 2009 8:59 am

Hi, I am looking for a way to stop a script, kinda.

For example:

if(strlen($username ) == 0)

{ echo "Username is empty! All fields are required!"; }

If it echo's "Username is empty! All fields are required!" I want it to stop running, so that no further error messages display in my script, but if it does not echo then I continues running.

Is there a way to do this?
 

Comments

if(strlen($username ) == 0)

{ echo "Username is empty! All fields are required!";
exit();
}

By: Manoj | 02 Jan 2009

Yes, that's right. You can choose whether to use
exit() or die() as your statement to stop the script.

By: Manoj | 02 Jan 2009

Leave a comment

Enter the text in the image
img
Can't read?
Type the characters you see in the picture below.


Close Move