Re: ||=
| From: | Andrey Hristov | Date: | Fri, 08 Mar 2002 19:00:09 +0000 |
| Subject: | Re: ||= | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-80941@lists.php.net to get a copy of this message | ||
> i think, given that php's || and && operators always return a boolean
> value, people are going to be confused and disappointed with ||= and &&=
> when coming from languages (like perl) that implement them as returning
> false or the value that was true.
I think that PHP is closer to C than Perl.
int main(void){
int a,b=5,c=2;
a=b&&c;
printf("%d",a);
}
Prints : 1
If b==0 -> prints 0.
So I think that it is better expected to return boolean value instead of
non-bool value.
Andrey