rossmurphy Posted August 3, 2009 Share Posted August 3, 2009 I have these two simple XML elements, they both contain the same attributes. I need to merge them into a single xmlobject. Is this possible? SimpleXMLElement Object ( [@attributes] => Array ( [configId] => 9 [denominations] => 0.05, 0.25, 0.5, [gameCurrency] => GBP [gameName] => 7s Ablaze (5 Line) [gameSource] => parlay [gameType] => SL [maxBet] => 0.5 [maxCoins] => 0 [minBet] => 0.05 [minCoins] => 1 [screenName] => 7s Ablaze (5 Line) [style] => BLA5 ) ) SimpleXMLElement Object ( [@attributes] => Array ( [configId] => 1 [denominations] => null [gameCurrency] => GBP [gameName] => MonsterCarlo [gameSource] => Orbis [gameType] => MC [maxBet] => 0.0 [maxCoins] => 0 [minBet] => 0.0 [minCoins] => 0 [screenName] => Monster Carlo [style] => ORBIS ) ) Quote Link to comment https://forums.phpfreaks.com/topic/168683-merge-simplexml-arrays/ Share on other sites More sharing options...
Daniel0 Posted August 3, 2009 Share Posted August 3, 2009 That doesn't make sense. How would would it look in XML if you merged two elements? Quote Link to comment https://forums.phpfreaks.com/topic/168683-merge-simplexml-arrays/#findComment-889858 Share on other sites More sharing options...
rossmurphy Posted August 3, 2009 Author Share Posted August 3, 2009 <rows> <row balance="208.13" bonus="0.0" cash="208.13" currency="GBP"/> </rows> <rows> <row balance="100.50" bonus="1.0" cash="999.59" currency="EUR"/> </rows> I want to combine these so they look like this: <rows> <row balance="208.13" bonus="0.0" cash="208.13" currency="GBP"/> <row balance="100.50" bonus="1.0" cash="999.59" currency="EUR"/> </rows> Quote Link to comment https://forums.phpfreaks.com/topic/168683-merge-simplexml-arrays/#findComment-889871 Share on other sites More sharing options...
Daniel0 Posted August 3, 2009 Share Posted August 3, 2009 SimpleXML isn't particularly good for editing XML, in my opinion. I would take a look at DOM instead. Quote Link to comment https://forums.phpfreaks.com/topic/168683-merge-simplexml-arrays/#findComment-889881 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.