Jump to content

[SOLVED] Array problem, merge array to array


hadingrh

Recommended Posts

need urgent help from you guys, please..

I have two arrays

- Array a = array ( [0] => 214 [1] => 216 [2] => 217 [3] => 452 )

and

- Array b = array ( [2] => 228 [3] => 229 )

Question is, how to push the array a to b so the result should be :

array ( [0] => 214 [1] => 216 [2] => 228 [3] => 229  [4] => 217 [5] => 452 )

 

?

Note that, it should be easy if the keys don't have brackets,  just sum array a + array b.

But they have.

Thanks for your kind before ;)

array_merge($array1, $array2);

thanks, but I've tried to merge it before.

Your result is, Array ( [0] => 214 [1] => 216 [2] => 217 [3] => 452 [4] => 228 [5] => 229 )

and not as my expected, i.e array ( [0] => 214 [1] => 216 [2] => 228 [3] => 229  [4] => 217 [5] => 452 )

 

and it should be working if they dont have brackets (just add array a+array b).

Why does it have brackets, it's because they produced from query streams.  And I dont have a clue to remove them (i.e bracket).

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.