Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70607 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51616 invoked from network); 12 Dec 2013 20:02:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Dec 2013 20:02:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.196 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.196 imap4.ox.registrar-servers.com Received: from [192.64.116.196] ([192.64.116.196:36006] helo=imap4.ox.registrar-servers.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A4/52-32587-4561AA25 for ; Thu, 12 Dec 2013 15:02:29 -0500 Received: from localhost (localhost [127.0.0.1]) by oxmail.registrar-servers.com (Postfix) with ESMTP id 1AA5E560071 for ; Thu, 12 Dec 2013 15:02:26 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap4.ox.registrar-servers.com Received: from oxmail.registrar-servers.com ([127.0.0.1]) by localhost (imap4.ox.registrar-servers.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id VRB8tCnr_Wpd for ; Thu, 12 Dec 2013 15:02:26 -0500 (EST) Received: from [192.168.0.13] (unknown [94.13.99.191]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by oxmail.registrar-servers.com (Postfix) with ESMTPSA id 63ADE560075 for ; Thu, 12 Dec 2013 15:02:23 -0500 (EST) Message-ID: <52AA1649.2090601@ajf.me> Date: Thu, 12 Dec 2013 20:02:17 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: PHP internals Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: [PROPOSAL] Alphanumeric decrement From: ajf@ajf.me (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? -- Andrea Faulds http://ajf.me/