RE: [PHP-DEV] Re: [VOTE] [RFC] Alphanumeric Decrement
| From: | Robert Stoll | Date: | Tue, 28 Jan 2014 09:39:46 +0000 |
| Subject: | RE: [PHP-DEV] Re: [VOTE] [RFC] Alphanumeric Decrement | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-71662@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Rouven Weßling [mailto:me@rouvenwessling.de]
> Sent: Tuesday, January 28, 2014 10:20 AM
> To: Tjerk Meesters
> Cc: Yasuo Ohgaki; Andrea Faulds; PHP internals
> Subject: Re: [PHP-DEV] Re: [VOTE] [RFC] Alphanumeric Decrement
>
>
> > On 28.01.2014, at 07:12, Tjerk Meesters <tjerk.meesters@gmail.com> wrote:
> >
> > Btw, doing flip/flop can be done with
$val = (bool)1 -
> > $val; as well :)
>
> There's an even easier way:
>
> $val = !$val;
>
> Personally I don't see a need to support increment/decrement for booleans. If at all they
> should be treated like they
were
> cast to an int first.
>
In my opinion, it really should behave like an int for ++/--
Yet, I would not mind if ++false = true and beginning with true it would change to int -> ++true
= 2, --true=false,
--false = -1 respectively