Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19712 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44603 invoked by uid 1010); 24 Oct 2005 22:54:10 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 44588 invoked from network); 24 Oct 2005 22:54:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2005 22:54:10 -0000 X-Host-Fingerprint: 80.219.12.45 80-219-12-45.dclient.hispeed.ch Received: from ([80.219.12.45:9360] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 3A/FA-22886-2166D534 for ; Mon, 24 Oct 2005 18:54:10 -0400 To: internals@lists.php.net,Marcus Boerger Message-ID: <435D66B5.5070309@cschneid.com> Date: Tue, 25 Oct 2005 00:56:53 +0200 User-Agent: Mozilla Thunderbird 1.0 (X11/20041207) X-Accept-Language: en-us, en MIME-Version: 1.0 References: <425333877.20051025002259@marcus-boerger.de> In-Reply-To: <425333877.20051025002259@marcus-boerger.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 80.219.12.45 Subject: Re: foreach with null From: cschneid@cschneid.com (Christian Schneider) Marcus Boerger wrote: > i would like to change foreach a tiny bit. Actually i don't like the > warning when using foreach with null. > > The way we use NULL in PHP should result in no warning here. The patch for Can you elaborate on the "The way we use NULL in PHP" part? IMPW (In my PHP world) null represents an undefined variable. Trying to iterate over it could be a programming mistake. Like iterating over a scalar value. I normally use foreach ((array)$var as $value) if $var is of "mixed" type which also catches null. But most of the time I'm more comfortable with making sure I provide a real array in all cases and don't rely on magic. Just my two cents, - Chris