Re: Empty xpath nodelist raises foreach error.
| From: | Thomas Bj?rk | Date: | Thu, 22 Apr 2004 09:15:45 +0000 |
| Subject: | Re: Empty xpath nodelist raises foreach error. | ||
| References: | 1 | Groups: | php.xml.dev |
| Request: | Send a blank email to php-xml-dev+get-361@lists.php.net to get a copy of this message | ||
I had a similar problem with foreach.
If you supply a string as argument to foreach then it will give an warning so I added an extra
if-statement.
if(is_array($arr)) {
foreach($arr as $key => $value) {
// Do somthing here
}
}
Hope this can help
/Thomas