Re: Logical OR in assignment
| From: | Richard Lynch | Date: | Thu, 28 Sep 2006 16:24:28 +0000 |
| Subject: | Re: Logical OR in assignment | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-242363@lists.php.net to get a copy of this message | ||
On Wed, September 27, 2006 10:05 pm, Larry Garfield wrote:
> The single pipe | is bitwise OR, yes. You're probably thinking of
> this
> construct:
>
> a = b || c
>
> Which is a valid and common default-value idiom in Python and
> Javascript, but
> I don't think works in PHP. (If it does, someone please correct me
> because
> I'd like to use it. <g>)
Check the operator precedence, as you might need $a = ($b || $c); but
there's nothing to stop you from using it if it make sense in context.
These basic operators are quite clearly documented in the manual...
Hint, hint.
--
Like Music?
http://l-i-e.com/artists.htm