Posted by Johnny on 10/11/35 11:57
"kenoli" <kenoli@igc.org> wrote in message
news:1157394155.661818.105050@p79g2000cwp.googlegroups.com...
>
> I tried using || in the following examples where you used && and got
> the following results:
>
> TRUE || FALSE && $q[] = "number = '{$v}'"; // doesn't set the array
>
> FALSE || TRUE && $q[] = "number = '{$v}'"; // sets the array
>
> What is the syntax here? I would think they should both set the array
No secret. All well documented.
There's simple rules for this, in PHP assignments are parsed in a right to
left order, and there's a thing called operator precedence.
in this case && has more precedence than ||
see here: http://nl3.php.net/manual/en/language.expressions.php
and here:
http://nl3.php.net/manual/en/language.operators.php#language.operators.prece
dence
Navigation:
[Reply to this message]
|