note 60205 deleted from function.die by tularis
| From: | tularis@php.net | Date: | Thu, 15 Feb 2007 09:43:22 +0000 |
| Subject: | note 60205 deleted from function.die by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-123410@lists.php.net to get a copy of this message | ||
Note Submitter: enumeration at gmail dot com
----
It's very useful on websites to have all your code in functions, then use "return"
instead of die. For example:
function log_in() {
if(!isset($_POST[password])) {
print "You must supply a password.";
return;
}
// rest of the login function here
}
This way it exits out of the function, gives an error message, but doesn't keep the website
from finishing loading.