Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70616 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93408 invoked from network); 13 Dec 2013 05:58:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Dec 2013 05:58:09 -0000 Authentication-Results: pb1.pair.com header.from=php@marc-bennewitz.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@marc-bennewitz.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain marc-bennewitz.de from 80.237.132.171 cause and error) X-PHP-List-Original-Sender: php@marc-bennewitz.de X-Host-Fingerprint: 80.237.132.171 wp164.webpack.hosteurope.de Received: from [80.237.132.171] ([80.237.132.171:33012] helo=wp164.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EA/69-32587-EE1AAA25 for ; Fri, 13 Dec 2013 00:58:08 -0500 Received: from dslb-088-072-000-095.pools.arcor-ip.net ([88.72.0.95] helo=[192.168.178.27]); authenticated by wp164.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) id 1VrLlD-0007JO-Qq; Fri, 13 Dec 2013 06:58:03 +0100 Message-ID: <52AAA1EA.7030106@marc-bennewitz.de> Date: Fri, 13 Dec 2013 06:58:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: internals@lists.php.net References: <52AA1649.2090601@ajf.me> In-Reply-To: <52AA1649.2090601@ajf.me> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;php@marc-bennewitz.de;1386914288;bc441d72; Subject: Re: [PHP-DEV] [PROPOSAL] Alphanumeric decrement From: php@marc-bennewitz.de (Marc Bennewitz) Hi Decrementing "a" to a number isn't a good idea because on incrementing again you will increment the number and not go back to "a". In my opinion this should be a warning/error and the value should stay as "a". This warning/error should be triggered on incrementing/decrementing a non alphanumeric string (inclusive an empty string), too. Greetings Marc Am 12.12.2013 21:02, schrieb Andrea Faulds: > Good evening, > > At present, it's possible to increment (++) an alphanumeric string, such > that "a" when incremented becomes "b", "z" becomes "aa", and so on. > > However, it's irritated me that the same is not true for the decrement > (--) operator. At present, "aa" when decremented stays as "aa", and "b" > when decremented stays as "b". This lack of symettry is counterintuitive > to me. I don't think it's what you would expect here. > > So I've written a patch which would change this. "aa" when decremented > would be "z", and "b" when decremented would be "a". It also handles > decrementing "a", which becomes "0". This creates an interesting new > asymettry: {$a = "a"; $a--; $a++;} will result in $a being integer 1. I > think it's better than the previous behaviour, though, which resulted in > "b". > > The diff is here: > https://github.com/TazeTSchnitzel/php-src/compare/php:PHP-5.6...AlphanumericDecrement > > > My aim is to try and get this into PHP 5.6, if people are interested. > Thoughts? >