Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68160 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37679 invoked from network); 18 Jul 2013 13:46:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jul 2013 13:46:20 -0000 Authentication-Results: pb1.pair.com header.from=me@chrislondon.co; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@chrislondon.co; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain chrislondon.co does not designate 74.125.82.182 as permitted sender) X-PHP-List-Original-Sender: me@chrislondon.co X-Host-Fingerprint: 74.125.82.182 mail-we0-f182.google.com Received: from [74.125.82.182] ([74.125.82.182:57668] helo=mail-we0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 25/A6-20914-9A1F7E15 for ; Thu, 18 Jul 2013 09:46:19 -0400 Received: by mail-we0-f182.google.com with SMTP id p60so2957325wes.13 for ; Thu, 18 Jul 2013 06:46:14 -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:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=91IPJv3NGoTfXd6rhYhkc5xE7B7O9/IKp8mnlJAHArY=; b=atugkJDSNP9xIx44cbrquIz2wx/MVSUKkvE0NLOgspTqZ9XhfOf1GhC8hYmYqxFvsC uVjicaiCQtZSbRg8NTqSoWx/03AoZxiFBJ5xr/lSYv+VXmApgUDya42+MnYkN5XwvM0L BEgYtE0rLSMUR8lIVOO7xmj5Ft0EfcWxKOHjHn44GBHyaUV7KMIkNLoBEtYKJVWlUKJK L+DK3nH6/ciBlzieseqzWyYvGBo0Ca8icgO3EM3p1y36urj3tytVezSFVJ9hhpBpF5VI stMF5945R1zXlh5Um2DRpyue8o0Jtxe0tbfiBeFIWQKaoSKY3gi5VfgKd784BW4F/k3D yEyQ== MIME-Version: 1.0 X-Received: by 10.180.38.45 with SMTP id d13mr8139624wik.62.1374155174567; Thu, 18 Jul 2013 06:46:14 -0700 (PDT) Received: by 10.216.159.193 with HTTP; Thu, 18 Jul 2013 06:46:14 -0700 (PDT) X-Originating-IP: [66.219.207.210] Date: Thu, 18 Jul 2013 07:46:14 -0600 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=e89a8f6470030bf42704e1c96f9e X-Gm-Message-State: ALoCoQnXxeLrDuMrAS2IB9F5DBRNf4D++YFCpYfzzJUKKpxbFj8BNwGvPxJ0ccGFROT8n24gl/hi Subject: Feature Proposal: Allow letter decrementing From: me@chrislondon.co (Chris London) --e89a8f6470030bf42704e1c96f9e Content-Type: text/plain; charset=ISO-8859-1 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. My question is, why specifically doesn't it? 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 --e89a8f6470030bf42704e1c96f9e--