RE: [PHP-DEV] Re: power operator (again)

From: Date: Sat, 21 Dec 2013 13:03:09 +0000
Subject: RE: [PHP-DEV] Re: power operator (again)
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-70815@lists.php.net to get a copy of this message

> -----Original Message-----
> From: Rowan Collins [mailto:rowan.collins@gmail.com]
> Sent: Saturday, December 21, 2013 1:00 PM
> To: internals@lists.php.net
> Subject: Re: [PHP-DEV] Re: power operator (again)
> 
> On 21/12/2013 10:29, Robert Stoll wrote:
> > echo ( -3 * 2); // -6
> > $x = -3;
> > echo $x * 2; // -6 -> does not behave like (-3) * 2
> 
> This is an extremely poor choice of example: (-3) * 2 and -(3*2) both
> evaluate to -6 anyway, since unary minus is effectively multiplication
> by -1, and therefore commutative with multiplication.

Indeed, was probably too tired when I wrote the example :) sorry for cluttering up the discussion




Thread (29 messages)

« previous php.internals (#70815) next »