Re: Boolean Assignment Operator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Wow, thanks for the quick replies!

I hadn't realised that & was purely a bitwise operator.

In the strongly-typed Java world, & works as a non-lazy (exhaustive?)
boolean operator so it has to return a boolean for boolean inputs.
Thats the difference here, and Robert got it in one.

Gavin.

PS. A code restructure isn't really appropriate here. The original
executes several SQL statements inside a transaction and needs to know
whether to commit or rollback at the end. The example was simplified
to get the point across but thanks for the suggestions.

On Tue, Feb 3, 2009 at 12:26 AM, Edmund Hertle
<edmund.hertle@xxxxxxxxxxxxxxx> wrote:
> 2009/2/2 Robert Cummings <robert@xxxxxxxxxxxxx>
>>
>> On Tue, 2009-02-03 at 00:07 +1100, Gavin Hodge wrote:
>> > In Java / C# / C,
>> > $bool &= $anotherBool;
>> > is shorthand for
>> > $bool = $bool & $anotherBool;
>> >
>> > So &= forces a reference assignment?
>>
>> No, =& forces reference assignment. &= works as you have written.
>>
>> Cheers,
>> Rob.
>
> Oh yeah... sorry, mixed it up...
> -eddy
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux