Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80881 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34125 invoked from network); 20 Jan 2015 15:54:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jan 2015 15:54:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=dennis@birkholz.biz; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=dennis@birkholz.biz; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain birkholz.biz does not designate 144.76.185.252 as permitted sender) X-PHP-List-Original-Sender: dennis@birkholz.biz X-Host-Fingerprint: 144.76.185.252 mx01.nexxes.net Received: from [144.76.185.252] ([144.76.185.252:60430] helo=mx01.nexxes.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/50-32230-54A7EB45 for ; Tue, 20 Jan 2015 10:54:46 -0500 Received: from [137.226.183.192] (ip3192.saw.rwth-aachen.de [137.226.183.192]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: db220660-p0g-1@packages.nexxes.net) by mx01.nexxes.net (Postfix) with ESMTPSA id B5A05480B37 for ; Tue, 20 Jan 2015 16:54:42 +0100 (CET) Message-ID: <54BE7A42.2020101@birkholz.biz> Date: Tue, 20 Jan 2015 16:54:42 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: internals@lists.php.net References: <54BE7749.2010603@gmail.com> In-Reply-To: <54BE7749.2010603@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] in Operator From: dennis@birkholz.biz (Dennis Birkholz) Am 20.01.2015 um 16:42 schrieb Rowan Collins: > Given the ability to write foreach ( $foo as $key => $value ), I'm not > sure adding a variant syntax of for ( $key in $foo ) has that much value > for PHP. I totally agree with you here. The only real reason why Javascript has a for-in operation that iterates over object properties is the lack of non-integer keys in Javascript arrays. For PHP iterating over object properties is a very rare case IMHO. So I would stick with foreach for that case. Kind regards, Dennis Birkholz