Re: foreach with null
| From: | Christian Schneider | Date: | Tue, 25 Oct 2005 17:28:09 +0000 |
| Subject: | Re: foreach with null | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-19721@lists.php.net to get a copy of this message | ||
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