spiffy error handling ...
| From: | Alexander Ross | Date: | Fri, 09 Aug 2002 15:32:13 +0000 |
| Subject: | spiffy error handling ... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-111829@lists.php.net to get a copy of this message | ||
This may be kids play for some of you, but I figured this out and thought
I'd share...
$connect = connect-to-db() or (alert("error") xor die());
or
$connect = connect-to-db() or (alert("error") xor return(false));
It makes for much cleaner code than what I used to do:
$connect = connect-to-db()
if (!$connect){
alert("Error");
return(false);
}
Alex