2009/2/2 Gavin Hodge
Hi,
I'm fairly new to PHP, having migrated from the Java / C# world.
I wrote some code similar to the following:
$success = true;
$success &= operation1();
$success &= operation2();
if ($success === true) {
operation3(); // depends on 1 and 2 being successful
}
It actually will return FATAL ERROR or something like that since you didn't
echo'ed variables or string ;)
On Mon, Feb 2, 2009 at 3:03 PM, Edmund Hertle wrote:
> 2009/2/2 Gavin Hodge
>
> > Hi,
> >
> > I'm fairly new to PHP, having migrated from the Java / C# world.
> >
> > I wrote some code sim
> -Original Message-
> From: farn...@googlemail.com [mailto:farn...@googlemail.com] On Behalf
> Of Edmund Hertle
> Sent: Monday, February 02, 2009 7:03 AM
> To: Gavin Hodge
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Boolean Assignment Operator
>
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 c
2009/2/2 Robert Cummings
> 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 writte
On Mon, Feb 2, 2009 at 7:49 AM, Gavin Hodge wrote:
> Hi,
>
> I'm fairly new to PHP, having migrated from the Java / C# world.
>
> I wrote some code similar to the following:
>
> $success = true;
> $success &= operation1();
> $success &= operation2();
>
> if ($success === true) {
>operation3();
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.
--
http://www.interjinn.c
On Mon, 2009-02-02 at 23:49 +1100, Gavin Hodge wrote:
> Hi,
>
> I'm fairly new to PHP, having migrated from the Java / C# world.
>
> I wrote some code similar to the following:
>
> $success = true;
> $success &= operation1();
> $success &= operation2();
>
> if ($success === true) {
> operat
In Java / C# / C,
$bool &= $anotherBool;
is shorthand for
$bool = $bool & $anotherBool;
So &= forces a reference assignment?
On Tue, Feb 3, 2009 at 12:03 AM, Edmund Hertle
wrote:
> 2009/2/2 Gavin Hodge
>>
>> Hi,
>>
>> I'm fairly new to PHP, having migrated from the Java / C# world.
>>
>> I wrot
2009/2/2 Gavin Hodge
> Hi,
>
> I'm fairly new to PHP, having migrated from the Java / C# world.
>
> I wrote some code similar to the following:
>
> $success = true;
> $success &= operation1();
> $success &= operation2();
>
> if ($success === true) {
>operation3(); // depends on 1 and 2 being
10 matches
Mail list logo