Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70628 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46768 invoked from network); 13 Dec 2013 18:02:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Dec 2013 18:02:07 -0000 Authentication-Results: pb1.pair.com header.from=php@tutteli.ch; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=php@tutteli.ch; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain tutteli.ch designates 80.74.154.78 as permitted sender) X-PHP-List-Original-Sender: php@tutteli.ch X-Host-Fingerprint: 80.74.154.78 ns73.kreativmedia.ch Linux 2.6 Received: from [80.74.154.78] ([80.74.154.78:60180] helo=hyperion.kreativmedia.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DD/91-32587-C9B4BA25 for ; Fri, 13 Dec 2013 13:02:06 -0500 Received: (qmail 29406 invoked from network); 13 Dec 2013 19:01:59 +0100 Received: from heim-032-99.raab-heim.uni-linz.ac.at (HELO RoLaptop) (193.171.32.99) by ns73.kreativmedia.ch with (AES128-SHA encrypted) SMTP; 13 Dec 2013 19:01:59 +0100 To: "'Tjerk Meesters'" , "'Kris Craig'" Cc: "'Marc Bennewitz'" , "'PHP internals list'" References: <52AA1649.2090601@ajf.me> <52AAA1EA.7030106@marc-bennewitz.de> In-Reply-To: Date: Fri, 13 Dec 2013 19:01:56 +0100 Message-ID: <001001cef82d$698c6b30$3ca54190$@tutteli.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQE2o4EeYQRVOKgLPkrQky8iC/AkdQKyLAnYAc6IcRICDzDd8AE7WDS9AfWqhKCbNQb34A== Content-Language: de-ch Subject: RE: [PHP-DEV] [PROPOSAL] Alphanumeric decrement From: php@tutteli.ch ("Robert Stoll") > -----Original Message----- > From: Tjerk Meesters [mailto:tjerk.meesters@gmail.com] > Sent: Friday, December 13, 2013 1:54 PM > To: Kris Craig > Cc: Marc Bennewitz; PHP internals list > Subject: Re: [PHP-DEV] [PROPOSAL] Alphanumeric decrement > > > > > > >> > >> That said, isn't it bad enough that php already has exceptions such as: > >> * ++$x is not always the same as $x += 1 > >> * ++false remains false, but ++null becomes int(1) > >> > > [Robert Stoll] Thanks for this information, I wasn't even aware of that PHP behaves so strange when it comes to true/false in combination with the ++ or -- operator. I always expected that they would behave like int's when an arithmetic operator is applied. > > As a matter of fact, I've created a rough patch, not to lobby against the > ability to decrement_string() per se, but to move string logic to where it > belongs; inside ext/standard/string.c > > The branch differences can be found here: > https://github.com/datibbaw/php-src/compare/master...inc-dec-patch > > Basically it makes the `$x++` or `++$x` work as if you types `$x += 1` or > `$x = $x + 1` (except for arrays, currently) > > So: > > ++false becomes int(1), --false becomes int(-1) > ++true becomes int(2), --true becomes int(0) > ++null becomes int(1), --null becomes int(-1) > ++"123a" becomes "123b" but with a notice that string increment is > deprecated > [Robert Stoll] +1 Awesome, that's exactly what I would expect (except the last line but I never do such things anyway)