PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
SimpleXML doesn't offer much in the way of advanced XML tree manipulation, as you've undoubtedly discovered. There is no function for adding a child of a given node in a particular place, unlike Java. I could only suggest that you copy the tree node by node and insert the new node while performing the copy, athough that gets unreasonably expensive rather quickly. What's the motivation behind the specific placement; schema conformity or purely cosmetic?