Jump to content

concatenating SimpleXMLElements


nicholasstephan

Recommended Posts

How do I concatenate two SimpleXMLElements? For example:

 

I've got:

 

<contacts />

 

as one SimpleXMLElement, called $contactList, and:

 

<contact>

    <name>Bob</name>

    <phone>4852342394</phone>

</contact>

 

as another called $bob.

 

Now I want to say $contactList->addChild("contact", $bob);, or something to that effect.

 

Apart from looping through $bob and addChilding each line individually the way they do in the docs, is there any way to accomplish this?

Link to comment
https://forums.phpfreaks.com/topic/138734-concatenating-simplexmlelements/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.