jeudi 28 juillet 2016

How do I combine these Array values?

Hi I have the following Array structure, how can I merge the sub-array values by ['number'] ?

 array(4) { 
          ["success"]=> bool(true) 
          ["messages"]=> array(2)
           {  

            ["0"]=> array(5){

                ["number"]=>string(1)                           
                ["incoming_id"]=> string(6)                        
                ["usernumber"]=> string(13)                         
                ["content"]=> string(4)                           
                ["date"]=> string(10)  

                }

            ["1"]=> array(5){

                ["number"]=>string(1)                           
                ["incoming_id"]=> string(6)                        
                ["usernumber"]=> string(13)                         
                ["content"]=> string(4)                           
                ["date"]=> string(10)  

                }  
        }             
       ["start"]=> string(1) 
       ["next"]=> string(2) 
       }

I want the following thing: If the value of ['number'] in [0] is the same as in [1] they should be saved in one new Array. For Example [0]['number']-> 1234 and [1]['number'] -> 1234 their values should be merged into one array named [1234]-> content from [0]['content'] , content from [1]['content'].

Thanks for your help.

Aucun commentaire:

Enregistrer un commentaire