>is there a more programmatically elegant way of saying...

One option would be to just exit; when you get an error if the rest of the
script isn't going to execute and send out some closing tags you need
anyway.

Future versions of PHP might have a try/catch mechanism, but that doesn't
help you right now.

You may want to look into http://php.net/trigger_error and see if you can't
arrange for all your closing tags to be spit out by a function that you can
call inside that, and then have the exit; there.

What you're doing is "fine" though, if you can live with it.

Or, you might be able to get your "error" problems into functions separate
from the "do" parts:

if (!($error = something1()) && !($error = something2()) && !($error =
something3())){
  # Okay to proceed with all 3 steps.
}
else{
  echo "Error $error<BR>\n";
}

The error line can get kinda long there, but you can make it three lines, or
just leave it alone -- It's really not that big a deal if you "play nice"
and have *ONLY* more of the same stuff in the rest of the ().  How often do
you need to scroll right to see the same damn thing repeated when trying to
debug?

>
>$isError = "";
>
>function main() {
>
>    doStep1();
>
>    if (!$isError) {
>        doStep2();
>    }
>
>    if (!$isError) {
>        doStep3();
>    }
>    // etc. etc.
>}
>
>function doStep1() {
>    if ($something) {
>        $isError = 1;
>    }
>}
>
>function doStep2() {
>    if ($something) {
>        $isError = 1;
>    }
>}
>
>_________________________________________________________________
>Join the world’s largest e-mail service with MSN Hotmail.
>http://www.hotmail.com
>


--
Like Music?  http://l-i-e.com/artists.htm
I'm looking for a PRO QUALITY two-input sound card supported by Linux (any
major distro).  Need to record live events (mixed already) to stereo
CD-quality.  Soundcard Recommendations?
Software to handle the recording? Don't need fancy mixer stuff.  Zero (0)
post-production time.  Just raw PCM/WAV/AIFF 16+ bit, 44.1KHz, Stereo
audio-to-disk.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to