neon Source Posted May 2, 2009 Share Posted May 2, 2009 The issue is that for some reason i can't figure out it only removes precisely half of the elements in the DOMNodelist. $deleteList = $doc->getElementsByTagName('photo'); foreach ($deleteList as $deleteEntry) { $root->removeChild($deleteEntry); } Link to comment https://forums.phpfreaks.com/topic/156517-problems-removing-elements-from-a-domdocument/ Share on other sites More sharing options...
neon Source Posted May 2, 2009 Author Share Posted May 2, 2009 The issue is that for some reason i can't figure out it only removes precisely half of the elements in the DOMNodelist. $deleteList = $doc->getElementsByTagName('photo'); foreach ($deleteList as $deleteEntry) { $root->removeChild($deleteEntry); } it seems that the loop doesnt run for all the entries in the list. Link to comment https://forums.phpfreaks.com/topic/156517-problems-removing-elements-from-a-domdocument/#findComment-824169 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.