Re: [PHP] Logical OR in assignment



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
.



Relevant Pages

  • Re: sum and strings
    ... Just because it's common doesn't mean it's obvious. ... it's as ugly as sin, and the fact that it's an idiom shows a ... shortcoming in Python. ...
    (comp.lang.python)
  • Re: sum and strings
    ... Bill Pursell wrote: ... the ''.join idiom is quite ... common in Python. ...
    (comp.lang.python)
  • Re: Trivia Question for the week (disguised offer)
    ... Riders, Jerry Garcia Band, Stoneground, Santana, Creedence, and Tower of ... Power all have in common? ... Hint: July 4, 1971. ...
    (rec.music.gdead)
  • Re: Trivia Question for the week (disguised offer)
    ... Riders, Jerry Garcia Band, Stoneground, Santana, Creedence, and Tower of ... Power all have in common? ... Hint: July 4, 1971. ...
    (rec.music.gdead)
  • Re: object data member dumper?
    ... Bruno Desthuilliers wrote: ... What are "object data members"? ... (hint: in Python, everything is an object - even functions and methods). ...
    (comp.lang.python)