eits Posted August 3, 2009 Share Posted August 3, 2009 Hi! I'm really stuck trying to work out how to merge an array like so...... I have two arrays, both have three data values (name, version, rating) in it. In each of the arrays will be data which matches (the name and version). Is there a function which would help me merge these arrays so that I could have the rating from array2 appended onto array1.. something like this: Array ( [0] => Array ( [Name] => Array ( [0] => SimpleXMLElement Object ( [0] => SP Press ) ) [0] => Array ( [Version] => Array ( [0] => SimpleXMLElement Object ( [0] => 14.00 ) ) [0] => Array ( [Array1Rating] => Array ( [0] => SimpleXMLElement Object ( [0] => Good ) ) [0] => Array ( [Array2Rating] => Array ( [0] => SimpleXMLElement Object ( [0] => Good ) ) ) ) ) ) Sorry if this isn't clear, please ask if you need any elaboration! Link to comment https://forums.phpfreaks.com/topic/168707-help-appending-from-one-array-into-another/ Share on other sites More sharing options...
TeNDoLLA Posted August 3, 2009 Share Posted August 3, 2009 You could possible do <?php echo '<pre>'; print_r($yourArrayNow); echo '/<pre>'; and paste it from there, at the moment that array is quite a mess to read from this forum. And ofcourse even better if you would modify and add the desired result also in that format. Link to comment https://forums.phpfreaks.com/topic/168707-help-appending-from-one-array-into-another/#findComment-890086 Share on other sites More sharing options...
eits Posted August 3, 2009 Author Share Posted August 3, 2009 OK - this is what I want it to look like after they are merged! Array ( [0] => Array ( [Name] => Array ( [0] => SimpleXMLElement Object ( [0] => SP Press ) ) [0] => Array ( [Version] => Array ( [0] => SimpleXMLElement Object ( [0] => 14 ) ) [0] => Array ( [Array1Rating] => Array ( [0] => SimpleXMLElement Object ( [0] => 80 ) ) [0] => Array ( [Array2Rating] => Array ( [0] => SimpleXMLElement Object ( [0] => 50 ) ) ) ) ) ) Link to comment https://forums.phpfreaks.com/topic/168707-help-appending-from-one-array-into-another/#findComment-890097 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.