Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19722 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21565 invoked by uid 1010); 25 Oct 2005 18:51:37 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 21549 invoked from network); 25 Oct 2005 18:51:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Oct 2005 18:51:37 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:49904] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 86/11-22886-8BE7E534 for ; Tue, 25 Oct 2005 14:51:37 -0400 Received: from [192.168.1.3] (dslb-084-063-037-243.pools.arcor-ip.net [84.63.37.243]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id 6EE4D35C393; Tue, 25 Oct 2005 20:54:34 +0200 (CEST) Date: Tue, 25 Oct 2005 20:51:37 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1526862482.20051025205137@marcus-boerger.de> To: Christian Schneider Cc: Ants Aasma , internals@lists.php.net In-Reply-To: <435E6B29.8010907@cschneid.com> References: <425333877.20051025002259@marcus-boerger.de> <435E5579.20802@zend.com> <06.4B.22886.EA26E534@pb1.pair.com> <435E6B29.8010907@cschneid.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] foreach with null From: helly@php.net (Marcus Boerger) Hello Christian, Tuesday, October 25, 2005, 7:28:09 PM, you wrote: > 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. Hey you two guys pointed out the reason very exactly! Only the usecase wasn't SPL but a potential change i want to do in SimpleXML and the reson SXE behaves like it currently does. But yes SPL and PDO would probably benefit in the same way. Best regards, Marcus