Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80857 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68423 invoked from network); 20 Jan 2015 05:36:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jan 2015 05:36:06 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.169 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.216.169 mail-qc0-f169.google.com Received: from [209.85.216.169] ([209.85.216.169:57687] helo=mail-qc0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9B/A3-41341-249EDB45 for ; Tue, 20 Jan 2015 00:36:02 -0500 Received: by mail-qc0-f169.google.com with SMTP id b13so10744042qcw.0 for ; Mon, 19 Jan 2015 21:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=Ofi7Vaut0OAnKIbs82PtGRTHIDIFeS0uCQfbBRz5uok=; b=XtqLIZjEbp3pdITfI0zv9dlxudxZbJnWUZ9/KgHiuCkN3FX3dP/e67mPjqdo/7c2EQ yc9DZCgNxGPDYOtOthFVhAHVJpGFypBRGNv2m9jB7yHRkaGTPPqS4qfU3yctr6B3XrkX KtHz6D6xbKFIC0m8eQiwJC9U1eVrgzZboW4OI4s+/ScKhtTGbVeqiDmgTc8cLh9CO08m UpHwUUyPDgrzDxFms6VAsYPrnEDulFEtGRPKBhRwQdmdA6eD1efZ381Do8nznEsKuz9l HpwcbQHJYlyes7u1+f/Z8sQfUhKk56sG+IDzwUm3MVjLLu1OF4hSd5w0eGg9qlnO1z/4 FSVQ== MIME-Version: 1.0 X-Received: by 10.140.81.208 with SMTP id f74mr6073002qgd.94.1421732159902; Mon, 19 Jan 2015 21:35:59 -0800 (PST) Received: by 10.140.22.106 with HTTP; Mon, 19 Jan 2015 21:35:59 -0800 (PST) In-Reply-To: References: Date: Tue, 20 Jan 2015 06:35:59 +0100 Message-ID: To: Andrea Faulds Cc: Mike Willbanks , Niklas Keller , PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] in Operator From: pierre.php@gmail.com (Pierre Joye) On Tue, Jan 20, 2015 at 6:15 AM, Andrea Faulds wrote: > Hi Mike, > >> On 20 Jan 2015, at 03:30, Mike Willbanks wrote: >> >> I am very familiar with the in operator. However, the implementation >> would be incomplete without handling loops via the in operator. Many >> people when seeing an in operator also think of JavaScript. In that cas= e >> the in operator iterates over properties. As such in PHP we should be a= ble >> to iterate over associative arrays should the syntax be added. >> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statem= ents/for...in > > Why? We already have foreach/as which does exactly that, and unlike JS wh= ich added for/of, there=E2=80=99s nothing wrong with PHP=E2=80=99s foreach = so we don=E2=80=99t need support for a new symbol. Indeed, exactly same feature. Otherwise, well done again Andrea, love it ::) --=20 Pierre @pierrejoye | http://www.libgd.org