Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80854 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63625 invoked from network); 20 Jan 2015 05:16:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jan 2015 05:16:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.216 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.216 imap10-3.ox.privateemail.com Received: from [192.64.116.216] ([192.64.116.216:55181] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C8/A2-41341-294EDB45 for ; Tue, 20 Jan 2015 00:16:03 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id E6D612400AA; Tue, 20 Jan 2015 00:15:59 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap10.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap10.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id oksbB4KBqskg; Tue, 20 Jan 2015 00:15:59 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 8BB442400A9; Tue, 20 Jan 2015 00:15:58 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) In-Reply-To: Date: Tue, 20 Jan 2015 05:15:55 +0000 Cc: Niklas Keller , PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: References: To: Mike Willbanks X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] in Operator From: ajf@ajf.me (Andrea Faulds) Hi Mike, > On 20 Jan 2015, at 03:30, Mike Willbanks wrote: >=20 > 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 = case > the in operator iterates over properties. As such in PHP we should be = able > to iterate over associative arrays should the syntax be added. > = https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statemen= ts/for...in Why? We already have foreach/as which does exactly that, and unlike JS = which 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. -- Andrea Faulds http://ajf.me/