Re: Logical OR in assignment
- From: "DonO" <don.orban@xxxxxxxxx>
- Date: 28 Sep 2006 12:48:49 -0700
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>)
PHP will allow you to do the following...
if ( $answer == "yes" || $answer == "yep") {
echo "affirmative";
}
..... At least, I hope it does b/c I use it all the time ;-)
.
- References:
- Logical OR in assignment
- From: "Jason Karns"
- Re: [PHP] Logical OR in assignment
- From: Larry Garfield
- Logical OR in assignment
- Prev by Date: Moving Files from Servers Using PHP
- Next by Date: Re: [PHP] How do i check if a variable is a reference or a copy?
- Previous by thread: Re: [PHP] Logical OR in assignment
- Next by thread: regular expresion problem
- Index(es):
Relevant Pages
|