note 103256 deleted from class.domnodelist by danbrown
| From: | danbrown@php.net | Date: | Mon, 04 Apr 2011 15:29:10 +0000 |
| Subject: | note 103256 deleted from class.domnodelist by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-178482@lists.php.net to get a copy of this message | ||
Note Submitter: ohnobinki at ohnopublishing dot net
----
@geompse at gmail dot com
You most likely want to use foreach to iterate over a nodelist rather than a traditional for loop.
Ex.
foreach ($dom_element->childNodes as $child_node)
{
if ($child_node->nodeType != XML_ELEMENT_NODE)
continue;
/* Do something with the knowledge that $child_node is a DOMElement */
}