You may also use the hasChild function:
<?php
while($node->hasChildNodes()) {
$node->removeChild($node->childNodes->item(0));
}
?>
When you remove a childNode, the next node becomes the first one!
You may also use the hasChild function:
<?php
while($node->hasChildNodes()) {
$node->removeChild($node->childNodes->item(0));
}
?>
When you remove a childNode, the next node becomes the first one!