Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68162 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45264 invoked from network); 18 Jul 2013 14:36:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jul 2013 14:36:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.211.66 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.211.66 config.schlueters.de Received: from [217.114.211.66] ([217.114.211.66:53187] helo=config.schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F8/38-20914-A7DF7E15 for ; Thu, 18 Jul 2013 10:36:43 -0400 Received: from [192.168.2.20] (ppp-88-217-77-50.dynamic.mnet-online.de [88.217.77.50]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by config.schlueters.de (Postfix) with ESMTPSA id 0376D65ACA; Thu, 18 Jul 2013 16:36:38 +0200 (CEST) To: Chris London Cc: internals@lists.php.net In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Thu, 18 Jul 2013 16:33:40 +0200 Message-ID: <1374158021.3918.5.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Feature Proposal: Allow letter decrementing From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Thu, 2013-07-18 at 07:46 -0600, Chris London wrote: > My friend shared some code with me today that wasn't working for him. He > was incrementing letters like this: > > $letter = 'A'; > echo ++$letter; // Output: B > > He was then trying to decrement letters like this: > > $letter = 'B'; > echo --$letter; // Output: B > > He was really confused why his code wasn't working. Obviously the answer > is, PHP doesn't support decrementing letters. Oviously this documented in http://de2.php.net/manual/en/language.operators.increment.php ;-) > My question is, why specifically doesn't it? > > It seems logical that if we support increment we should support decrement. ++$string; will always succeed. But what should $s = 'a'; --$s; result in? johannes