Re: Empty xpath nodelist raises foreach error.

[email protected] (Thomas Bj?rk) 22 Apr 2004 09:15:45 -0000
Newsgroups php.xml.dev
Message-ID <[email protected]>
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