I'm tring to simply add a child element to a xml file. I new to php and feel like I'm making a stupid mistake with simplexml or php. The line $toreserve->addChild('child'); locks up the script. if you comment it out, the script will complete printing periods for all "air" elements. foreach ($xml->xpath('//air') as $toreserve){ //there's about 10 of them echo "."; //if ($toreserve['dispName'] == $_GET["item"]){ $toreserve['dispName'] = "mwahaha"; $toreserve->addChild('child'); //} } Please help... is $toreserve->addChild('child'); incorrect because of a variable type issue, or do i likely not have some portion of php installed? without the addChile line, I can then have it write the edited xml to file. Thanks,