Friday, 15 June 2012

How to merge this two specific arrays in PHP? -


I have this array:

  $ array ['apples'] [0] ['Name'] = 'some apples'; $ Array ['apple'] [0] ['value'] = 44; $ Array ['oranges'] [0] ['name'] = 'some orange'; $ Array ['oranges'] [0] ['value'] = 10;  

How can I merge two arrays, so I get this:

  $ array [0] ['name'] = 'something Apple'; $ Array [0] ['value'] = 44; $ Array [1] ['name'] = 'some orange'; $ Array [1] ['value'] = 10; I do not have PHP to test, but this is not just:  

$ array2 = $ array ['apple']; Array_merge ($ array2, $ array ['oranges']);

It is valid, now in $ array2 from

< / Html>

No comments:

Post a Comment