Forum Moderators: coopster

Message Too Old, No Replies

array merge.

         

Pico_Train

4:50 pm on Jun 17, 2008 (gmt 0)

10+ Year Member



Using array_merge in php, say I get a return bunch of arrays called:

$properties[]

$properties has 2 arrays in it - properties[0] and properties[1] each with arrays in them as well.

Now expanding on the sentence above that was used as an example that I am seeing in testing, the $properties array could have x indeces to it, I will not know how many.properties[0], properties[1], properties[x]

Can I just array_merge($properties);?

Or must I do something else?

Thanks for your help!

[edited by: coopster at 3:43 pm (utc) on June 20, 2008]
[edit reason] Disabled [codes] for this message [/edit]

d40sithui

7:57 pm on Jun 17, 2008 (gmt 0)

10+ Year Member



are you talking about a 2-dimensional array? if so you can try something like this.


$propertiesMerged = array();
for($i = 0; $i < sizeof($properties); $i++){
$propertiesMerged = array_merge($propertiesMerged, $properties[$i]);
}
print_r($propertiesMerged);
?>

Pico_Train

7:32 am on Jun 19, 2008 (gmt 0)

10+ Year Member



worked like a charm, thanks!