Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19721 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83340 invoked by uid 1010); 25 Oct 2005 17:28:16 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 83324 invoked from network); 25 Oct 2005 17:28:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Oct 2005 17:28:16 -0000 X-Host-Fingerprint: 195.141.85.117 uf1.search.ch Linux 2.4/2.6 Received: from ([195.141.85.117:44755] helo=verksam.search.ch) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id F1/BC-22886-F2B6E534 for ; Tue, 25 Oct 2005 13:28:15 -0400 Received: from localhost (localhost [127.0.0.1]) by verksam.search.ch (Postfix) with ESMTP id 76C1C1885FA; Tue, 25 Oct 2005 19:28:12 +0200 (CEST) Received: from unknown by localhost (amavisd-new, unix socket) id client-XXSm5Kt0; Tue, 25 Oct 2005 19:28:11 +0200 (CEST) Received: by verksam.search.ch (Postfix, from userid 65534) id BCDFF1885FC; Tue, 25 Oct 2005 19:28:11 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on verksam.search.ch X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 Received: from [192.168.1.72] (ultrafilter-i [192.168.85.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by verksam.search.ch (Postfix) with ESMTP id A1D7C1885FA; Tue, 25 Oct 2005 19:28:10 +0200 (CEST) Message-ID: <435E6B29.8010907@cschneid.com> Date: Tue, 25 Oct 2005 19:28:09 +0200 User-Agent: Mozilla Thunderbird 1.0 (X11/20041207) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ants Aasma Cc: internals@lists.php.net References: <425333877.20051025002259@marcus-boerger.de> <435E5579.20802@zend.com> <06.4B.22886.EA26E534@pb1.pair.com> In-Reply-To: <06.4B.22886.EA26E534@pb1.pair.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at search.ch Subject: Re: [PHP-DEV] foreach with null From: cschneid@cschneid.com (Christian Schneider) Ants Aasma wrote: > +-0 on the foreach issue, but with the SPL Iterators I can see where > Marcus is coming from. Ok, I can see the reason behind it now as casting to array is not an option for objects with SPL Iterators. One little side-note: Programmers will still have to do an if($obj) check if they use $obj for just about anything but foreach. After thinking it over you convinced me that treating null (and only null) like an empty array in foreach() might be a good idea, probably even for the non-SPL case. - Chris