Re: [PHP] Logical OR in assignment
- From: larry@xxxxxxxxxxxxxxxx (Larry Garfield)
- Date: Wed, 27 Sep 2006 22:05:27 -0500
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>)
On Wednesday 27 September 2006 21:05, Jason Karns wrote:
I once saw the use of OR (|) in assignment.
$x = $y | $z;
Does this use bitwise OR? I'm trying to see if I could use the above
expression in place of:
$x = is_null($y) ? $z : $y;
Jason Karns
~~~~~~~~~~~
The Ohio State University [www.osu.edu]
Computer Science & Engineering [www.cse.osu.edu]
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.8/455 - Release Date: 9/22/2006
--
Larry Garfield AIM: LOLG42
larry@xxxxxxxxxxxxxxxx ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson
.
- Follow-Ups:
- Re: Logical OR in assignment
- From: DonO
- Re: [PHP] Logical OR in assignment
- From: "Richard Lynch"
- Re: Logical OR in assignment
- References:
- Logical OR in assignment
- From: "Jason Karns"
- Logical OR in assignment
- Prev by Date: Re: [PHP] Best open source project/framework to support a php training course?
- Next by Date: RE: [PHP] Best open source project/framework to support a php training course?
- Previous by thread: Re: Logical OR in assignment
- Next by thread: Re: [PHP] Logical OR in assignment
- Index(es):