Jump to content

Help appending from one array into another.


eits

Recommended Posts

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!

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.

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
                                                )

                                        )

                                )

                        )

                )

        )

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.