Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68059 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86149 invoked from network); 3 Jul 2013 20:07:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jul 2013 20:07:38 -0000 Authentication-Results: pb1.pair.com header.from=robin@kingsquare.nl; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=robin@kingsquare.nl; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kingsquare.nl from 141.138.142.202 cause and error) X-PHP-List-Original-Sender: robin@kingsquare.nl X-Host-Fingerprint: 141.138.142.202 spring.kingsquare.nl Linux 2.6 Received: from [141.138.142.202] ([141.138.142.202:53914] helo=spring.kingsquare.nl) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 35/E0-15343-78484D15 for ; Wed, 03 Jul 2013 16:07:37 -0400 X-No-Relay: not in my network Received: from mail-la0-f52.google.com (mail-la0-f52.google.com [209.85.215.52]) by spring.kingsquare.nl (Postfix) with ESMTPSA id 20B7377C01D for ; Wed, 3 Jul 2013 22:07:32 +0200 (CEST) Received: by mail-la0-f52.google.com with SMTP id fo12so533745lab.39 for ; Wed, 03 Jul 2013 13:07:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=T9QUwiByFD2NYTfSmZ1bEriVjJlOX2UZgptyp6K2WWw=; b=QDw09ZRZAffALcbdDO5PfJeDEf6GS9svC98caTQ9t8QTLjGdSBtmnePYsyml8ZFnYG vRlSXU7iG3SaKRwz398THhGuTX1Hz8e2ecqoRe/fRgWP7NifwwEQjlqtY4eBjB3EACln Pz+6d6ZXlkvaM1hKDMCLMjqOiPiaizgkA12PG9uSly6tAchGVa8MekopEBO+K1bamuCu AllziDGy74TlOZ+l9x9Hs0oNy+nF7XqrPuqOgfP3F6wVKGj2WCDfzDziLi6uM3MOonUt X2BGRGucA5oSXJwI8tPG0gR2QXUHn6DVvPHV/bVMXcuR7mDbVwgymIgV5kfWyEiQ6ecF Taeg== X-Received: by 10.152.170.138 with SMTP id am10mr1273279lac.22.1372882051515; Wed, 03 Jul 2013 13:07:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.156.104 with HTTP; Wed, 3 Jul 2013 13:07:11 -0700 (PDT) In-Reply-To: References: Date: Wed, 3 Jul 2013 22:07:11 +0200 Message-ID: To: Chris London Cc: PHP internals Content-Type: multipart/alternative; boundary=089e01177213ffcd5004e0a102b0 Subject: Re: [PHP-DEV] New feature: additional syntax proposal for Foreach From: robin@kingsquare.nl ("Kingsquare.nl - Robin Speekenbrink") --089e01177213ffcd5004e0a102b0 Content-Type: text/plain; charset=UTF-8 Welcome Chris, As a `plain` user of PHP, i'd like to advocate not to allow anymore aliasing of ways to do stuff... Your example should just read foreach(array_keys($array) as $key) {} That's the only way to convey the actual intent of working with keys and explicitly leaving out the values ;) But hey, just my 2c... Met vriendelijke groet, Robin Speekenbrink Kingsquare BV 2013/7/3 Chris London > Hello community, > > This is my first post here. I hope to improve my participation in the > community and give back to the technology that has done so much for my > career. My first attempt is to propose an additional syntax for the > Foreach statement. > > Background: > > There are times in our code where we can leave things blank that we don't > need, such as: > > for ( ; ; ) { > > } > > - and - > > list( , $foo, $bar) = array('ignore', 'myFoo', 'myBar'); > > Proposal: > > I have found over the years that there are times when I want to loop > through an associative array but I don't need the value. I would like to > allow the following syntax: > > foreach ($array as $key => ) { > > } > > Please let me know your thoughts. > > Thanks > Chris London > --089e01177213ffcd5004e0a102b0--