Hi,
Friday, March 14, 2003, 7:13:15 AM, you wrote:
LG> I know that in a case like this
LG> if((test1) && (test2) && (test3)) {
LG> ...
LG> }
LG> if test1 fails, dear PHP won't bother doing test2 and 3. Am I correct? Is there a
syntax that will make it carry on with test2 and 3 anyway, regar
> 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, ma
Liam Gibbs wrote:
I know that in a case like this
if((test1) && (test2) && (test3)) {
...
}
if test1 fails, dear PHP won't bother doing test2 and 3. Am I correct? Is there a syntax that will make it carry on with test2 and 3 anyway, regardless of how test1 came out?
The more efficient compile
That's exactly what logical operators are for.
http://www.php.net/manual/en/language.operators.logical.php
use || instead of && for allowing either to be true.
if ((test1) || (test2) || (test3))
{
\\ if any of these can return true, this will execute
}
HTH,
Jason k Larson
Liam Gibbs wrote:
I kno
At 22:13 13.03.2003, Liam Gibbs said:
[snip]
>I know that in a case like this
>
>if((test1) && (test2) && (test3)) {
>...
>}
>
>if test1 fails, dear PHP won't bother doing test2 and 3. Am I correct? Is
>there a syntax that will make it carry on with test
I know that in a case like this
if((test1) && (test2) && (test3)) {
...
}
if test1 fails, dear PHP won't bother doing test2 and 3. Am I correct? Is there a
syntax that will make it carry on with test2 and 3 anyway, regardless of how test1
came out?
6 matches
Mail list logo