note 84208 added to function.exit
| From: | Lee at osu1 dot php dot net | Date: | Thu, 03 Jul 2008 10:35:33 +0000 |
| Subject: | note 84208 added to function.exit | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-141109@lists.php.net to get a copy of this message | ||
Regarding error handling, it's possible to exit from the PHP at any point and still output the
remaining HTML quite cleanly as follows...
<HTML><BODY><PRE>
<?php
function main_php()
{
// ...
if ( error )
{
echo "Something went wrong."
return 0;
}
// ... rest of your code...
// ...
return 0;
}
main_php()
?>
</PRE></BODY></HTML> <!-- Still output even if an error occurs -->
----
Server IP: 92.48.74.199
Probable Submitter: 86.1.163.237
----
Manual Page -- http://www.php.net/manual/en/function.exit.php
Edit -- https://master.php.net/note/edit/84208
Del: integrated -- https://master.php.net/note/delete/84208/integrated
Del: useless -- https://master.php.net/note/delete/84208/useless
Del: bad code -- https://master.php.net/note/delete/84208/bad+code
Del: spam -- https://master.php.net/note/delete/84208/spam
Del: non-english -- https://master.php.net/note/delete/84208/non-english
Del: in docs -- https://master.php.net/note/delete/84208/in+docs
Del: other reasons-- https://master.php.net/note/delete/84208
Reject -- https://master.php.net/note/reject/84208
Search -- https://master.php.net/manage/user-notes.php