Re: If 1 IF fails, do the rest anyway...
| From: | Liam Gibbs | Date: | Thu, 13 Mar 2003 22:14:18 +0000 |
| Subject: | Re: If 1 IF fails, do the rest anyway... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139613@lists.php.net to get a copy of this message | ||
> The more efficient compilers/parsers stop when one test fails, some do
> them all. I don't know which php does but surely it is irrelevant? If
> test1 fails, because of the "and" the "if" statement will not be
> executed. I wonder what the reason is for your wanting it to do test2
> and test3, maybe I'm missing something?
Upon downloading a file, I wanted to chmod, chgrp, and chown it. I wanted to
do it this way:
if((chmod) && (chgrp) && (chown)) {
print("Success!");
} else {
print("Failure!");
}
but I wanted it to at least attempt all of them, so at least I can get most
of the work done there.
Someone metioned just to do them separately and if the results, so I did
that.