Re: spiffy error handling ...

From: Date: Fri, 09 Aug 2002 15:34:00 +0000
Subject: Re: spiffy error handling ...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-111830@lists.php.net to get a copy of this message
p.s. alert is a simple function I wrote to call a javascript alert window. "Alexander Ross" <alexross@bleen.net> wrote in message news:20020809153238.20206.qmail@pb1.pair.com... > 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 > >

« previous php.general (#111830) next »