RE: [PHP-DEV] Re: foreach with null

From: Date: Mon, 24 Oct 2005 23:07:45 +0000
Subject: RE: [PHP-DEV] Re: foreach with null
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-19713@lists.php.net to get a copy of this message
> 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. Good point. Smells like a -1 to me. - David

« previous php.internals (#19713) next »