php - How can I merge or search an object? -


This is my problem:

I have an orange orange that looks like this. [37633 9] = & gt; Array ([0] = & gt; 1f422730-f54b-4e4d-9289-10258ce74446 [1] = 60dc4646-06ce-44d0-abe9-ee371847f4df)

Need to find objects matching with matching id, as if there is no such way without which there is a foreach? There are many and I do not want to loop on the whole item every time stdClass object ([id] = & gt; 1f422730-f54b-4e4d-9289-10258ce74446 [percent] = & Gt; 32 [Destinations] = & gt; Array ([0] => Study Class Object ([ID] => 59826 [destination_id] => 59826 [type] => Destination [ Dequeue] => [value] => xxxxxxxxxxx)) stdClass object ([id] => 60dc4646-06ce-44d0-abe9-ee371847f4df [percent] => 68 [destinations] = & gt; ; Array ([0] = & gt; stdClass object ([ID] => 60046 [destination_id] => 60046 [type] => destination [dequeue] => [value] => gt; ; Xxxxxxxxxxxx))

I must It looks like the end.

  [37633 9] = & gt; Array ([0] = & gt; array ([id] = & gt; 1f422730-f54b-4e4d-9289-10258ce74446 [percent] => 32 [places] => array ([0] = & gt; ; [StdClass object] ([id] = & gt; 59826 [destination_id] => 59826 [type] => destination [duplication] => [value] => xxxxxxxxxxx)) [1] = & Gt; array ([id] = & gt; 60dc4646-06ce-44d0-abe9-ee371847f4df [percent] = & gt; 68 [places] => array ([0] => stdClass object ([id ] = & Gt; 60046 [destination_id] => 60046 [type] = Destination [dequeue] => [value] => xxxxxxxxxxxx))   

I'm not sure that it has any meaning, this is the reason that I will have two bizarre outputs in one It's all coming from a huge Jason object and I'm using it as json_decode ($ jsonstuff) .

Do I have to type the True, then it would be easy? If I can do this only in Ajnant, then it will be clear but as it is, I am at a loss, the way I need to output.

Note: the input json can not be changed, I have no relation with those who have made it.

Create an array with the key in the form of first loop and ID on your input array

  $ input = json_decode ($ json_input); $ Output = array (); Forex Currency ($ input $ obj) {$ Output [$ obj- & gt; ID] = $ obj; }   

You can then create your second array by searching the ID on the array key

  $ massive_search_array = array (376339 => array (0 = & Gt; 1f422730-f54b-4e4d-9289-10258ce74446, 1 = & gt; 60dc4646-06ce-44d0-abe9-ee371847f4df)); $ End_output = array (); ($ $ [$ Search]) {$ end_output [$ index] [] = $ output [$ search] ($ $ $ [search])]; }}}    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -