Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68167 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72099 invoked from network); 18 Jul 2013 19:22:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jul 2013 19:22:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@chrislondon.co; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@chrislondon.co; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain chrislondon.co does not designate 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: me@chrislondon.co X-Host-Fingerprint: 74.125.82.54 mail-wg0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:57702] helo=mail-wg0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 37/5D-20914-C8048E15 for ; Thu, 18 Jul 2013 15:22:53 -0400 Received: by mail-wg0-f54.google.com with SMTP id n11so3312869wgh.9 for ; Thu, 18 Jul 2013 12:22:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=Lwro4FAPhEW6Xdwr+81g8Yfzmsz6h+59QxEmqN7pcfA=; b=ABclixJ8yS/mQ9c5lUx+oHhCD6kZY0xF1kHX8hkG81qb3A1+O8/8qPH+Im5nw4QR2+ PV2PLgulCH3PtQ3P3Uyj6f+/8zJxB2B3KnJcWim7f4jMbKEuQrYpwJlzquPA63ikZG+Z hGpvAfnHvpIXRJWHAqQMsjLmS6u69QPmZLYENHHZjQ7n/Km476b5zFdGzT4tKvyQ4N+S LPvg/PV+cZuTZ/T4R584xj4RQcK3pWZonU5YGYEWYegdrDxa8R03IJJarVQ6PISKKIDP ZEHCIQpZY5qlJkgeH36tBZQ60G5mqaoi4LMOG/Wg8PXLXGia8Uy8zfboJd+oKo3ldvGK pu1w== MIME-Version: 1.0 X-Received: by 10.194.174.137 with SMTP id bs9mr9576522wjc.59.1374175369434; Thu, 18 Jul 2013 12:22:49 -0700 (PDT) Received: by 10.216.159.193 with HTTP; Thu, 18 Jul 2013 12:22:49 -0700 (PDT) X-Originating-IP: [66.219.207.210] In-Reply-To: References: <-6008161650538629327@unknownmsgid> <13538DBB-9602-49C6-A212-661FF5DDAD5F@rtin.so> Date: Thu, 18 Jul 2013 13:22:49 -0600 Message-ID: To: Phil Sturgeon Cc: Martin Amps , Xinchen Hui , Mateusz Kocielski , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e0149331ec12d2204e1ce227c X-Gm-Message-State: ALoCoQlh25zBGi+lqVz4GKnXNMWVvncPR/cCH2EDo5SP0tVwXVjZBYdXHC0oe0fM6Qjd71hWLVG5 Subject: Re: [PHP-DEV] Feature Proposal: Allow letter decrementing From: me@chrislondon.co (Chris London) --089e0149331ec12d2204e1ce227c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The one caveat about decrementing "A" and it goes to NULL is that if you increment NULL it goes to 1 so that may be confusing. We could also decrement "A" and it goes to FALSE and FALSE++ is still FALSE On Thu, Jul 18, 2013 at 1:10 PM, Phil Sturgeon wr= ote: > Incrementing "Z" results in "AA", because we're starting again. > Decrementing "A" should probably go to NULL as -A is no good. > > -- > Phil Sturgeon > > On Thursday, July 18, 2013 at 3:08 PM, Martin Amps wrote: > > One hiccup. I imagine maybe the reason we don't support decrementing is > because what would happen if you tried to decrement 'A'. In that case I > would suggest either returning NULL or throwing a notice. > > > It would make sense to make it stay as =E2=80=98A=E2=80=99 like increment= ing =E2=80=98Z' stays as > =E2=80=98Z=E2=80=99. > > I do agree that string manipulation with arithmetic operators needs > work/clarification. > > On Jul 18, 2013, at 7:37 AM, Xinchen Hui wrote: > > =E5=9C=A8 2013-7-18=EF=BC=8C22:31=EF=BC=8CMateusz Kocielski =E5=86=99=E9=81=93=EF=BC=9A > > It seems logical that if we support increment we should support decrement= . > > > My proposal: > > > 1) Support decrementing letters > > - or - > > 2) Throw a notice explaining that decrementing is not supported so > > developers quickly know they can't do that > > > One hiccup. I imagine maybe the reason we don't support decrementing is > > because what would happen if you tried to decrement 'A'. In that case I > > would suggest either returning NULL or throwing a notice. > > > Thanks for the input > > > Chris London > > > Hello, > > Does anybody understand the rules behind the string incrementation? What'= s > the explanation of following behaviour? > > '$x=3D"ZZ";$x++;var_dump($x);' returns string(3) "AAA" > '$x=3D" ZZ";$x++;var_dump($x);' returns string(3) " AA" > > see http://www.php.net/manual/en/language.operators.increment.php > > thanks > > Regards, > Mateusz Kocielski > > > --089e0149331ec12d2204e1ce227c--