Search code examples
phpxml-serializationpearassociative-array

php array to xml, using same array key names


We are using pear's xml serializer to turn our request arrays into XML to submit to other servers for an XML response.

The problem is, for one of the attributes we will need to submit an XML similar to this

<totalRooms>
  <Room>
    ...
  </Room>
  <Room>
    ...
  </Room>
</totalRooms>

How do we compile this in PHP arrays so the Serializer produces the correct XML?

ie, we need:

Array("totalRooms" =>

Array("Room" => ...)

Array("Room" => ...)

)

Currently will not work because of the shared Key names "Room" end up overwriting each other... is there any other method?


Solution

  • We've taken this job from the server and given it to Flash (client-side platform), making the problem much easier to handle.

    Thank you Mr.Zombie for your response.