3v4l.org

run code in 300+ PHP versions simultaneously
<?php $jsonProducts = '[ { "name": "Fluted Guard of the Moon Rider", "icon": "-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KW1Zwwo4NUX4oFJZEHLbXK9QlSPcU_oAlcQk2fVOiSxMfcRlFwIBYYpbaaOA9vxv_MdC8M7tq0xoaOzvb2Z7iJxD8GsJIi0--Up9Sh0A2yr0pvZ22iJdXGdVQ5NUaQpAZGHIGG2g" }, { "name": "Lion Quiver of the Moon Rider", "icon": "-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KW1Zwwo4NUX4oFJZEHLbXK9QlSPcU_oAlcQk2fVOiSxtraRVhmahdbiauwIhFlwb2aImoS7oWwzIPYwqetYeKExm9SsMAg3b7AoNz32QDkqUNtMD2lJdPGbEZgNjYx8IO6" }, { "name": "Lion Quiver of the Moon Rider", "icon": "-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KW1Zwwo4NUX4oFJZEHLbXK9QlSPcU_oAlcQk2fVOiSxtraRVhmahdbiauwIhFlwb2aImoS7oWwzIPYwqetYeKExm9SsMAg3b7AoNz32QDkqUNtMD2lJdPGbEZgNjYx8IO6" } ]'; $jsonData = '{ "data": [ { "updated_at": 1576048969000, "prices": { "last": 5300 }, "name": "Lion Quiver of the Moon Rider" }, { "updated_at": 1576048969000, "prices": { "last": 2000.12 }, "name": "T-shirts" } ] }'; echo "<pre>"; $price = json_decode($jsonData, 1)['data']; $json = json_decode($jsonProducts, 1); foreach($price as $key => $value) { foreach($json as $k => $value2) { if ($value['name'] === $value2['name']){ $json[$k]['price'] = $value['prices']['last']; } } } print_r($json);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 32
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 32
Branch analysis from position: 16
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 30
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 30
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 29
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 29
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 30
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/mWaIS
function name:  (null)
number of ops:  37
compiled vars:  !0 = $jsonProducts, !1 = $jsonData, !2 = $price, !3 = $json, !4 = $value, !5 = $key, !6 = $value2, !7 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%0A++%7B%0A++++%22name%22%3A+%22Fluted+Guard+of+the+Moon+Rider%22%2C%0A++++%22icon%22%3A+%22-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KW1Zwwo4NUX4oFJZEHLbXK9QlSPcU_oAlcQk2fVOiSxMfcRlFwIBYYpbaaOA9vxv_MdC8M7tq0xoaOzvb2Z7iJxD8GsJIi0--Up9Sh0A2yr0pvZ22iJdXGdVQ5NUaQpAZGHIGG2g%22%0A++%7D%2C%0A++%7B%0A++++%22name%22%3A+%22Lion+Quiver+of+the+Moon+Rider%22%2C%0A++++%22icon%22%3A+%22-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KW1Zwwo4NUX4oFJZEHLbXK9QlSPcU_oAlcQk2fVOiSxtraRVhmahdbiauwIhFlwb2aImoS7oWwzIPYwqetYeKExm9SsMAg3b7AoNz32QDkqUNtMD2lJdPGbEZgNjYx8IO6%22%0A++%7D%2C%0A++%7B%0A++++%22name%22%3A+%22Lion+Quiver+of+the+Moon+Rider%22%2C%0A++++%22icon%22%3A+%22-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KW1Zwwo4NUX4oFJZEHLbXK9QlSPcU_oAlcQk2fVOiSxtraRVhmahdbiauwIhFlwb2aImoS7oWwzIPYwqetYeKExm9SsMAg3b7AoNz32QDkqUNtMD2lJdPGbEZgNjYx8IO6%22%0A++%7D%0A++%5D'
   18     1        ASSIGN                                                   !1, '%7B%0A++++%22data%22%3A+%5B%0A++++++++%7B%0A++++++++++%22updated_at%22%3A+1576048969000%2C%0A++++++++++%22prices%22%3A+%7B%0A++++++++++++%22last%22%3A+5300%0A++++++++++%7D%2C%0A++++++++++%22name%22%3A+%22Lion+Quiver+of+the+Moon+Rider%22%0A++++++++%7D%2C%0A++++++++%7B%0A++++++++++%22updated_at%22%3A+1576048969000%2C%0A++++++++++%22prices%22%3A+%7B%0A++++++++++++%22last%22%3A+2000.12%0A++++++++++%7D%2C%0A++++++++++%22name%22%3A+%22T-shirts%22%0A++++++++%7D%0A++++%5D%0A%7D'
   37     2        ECHO                                                     '%3Cpre%3E'
   39     3        INIT_FCALL                                               'json_decode'
          4        SEND_VAR                                                 !1
          5        SEND_VAL                                                 1
          6        DO_ICALL                                         $10     
          7        FETCH_DIM_R                                      ~11     $10, 'data'
          8        ASSIGN                                                   !2, ~11
   40     9        INIT_FCALL                                               'json_decode'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 1
         12        DO_ICALL                                         $13     
         13        ASSIGN                                                   !3, $13
   42    14      > FE_RESET_R                                       $15     !2, ->32
         15    > > FE_FETCH_R                                       ~16     $15, !4, ->32
         16    >   ASSIGN                                                   !5, ~16
   44    17      > FE_RESET_R                                       $18     !3, ->30
         18    > > FE_FETCH_R                                       ~19     $18, !6, ->30
         19    >   ASSIGN                                                   !7, ~19
   45    20        FETCH_DIM_R                                      ~21     !4, 'name'
         21        FETCH_DIM_R                                      ~22     !6, 'name'
         22        IS_IDENTICAL                                             ~21, ~22
         23      > JMPZ                                                     ~23, ->29
   46    24    >   FETCH_DIM_R                                      ~26     !4, 'prices'
         25        FETCH_DIM_R                                      ~27     ~26, 'last'
         26        FETCH_DIM_W                                      $24     !3, !7
         27        ASSIGN_DIM                                               $24, 'price'
         28        OP_DATA                                                  ~27
   44    29    > > JMP                                                      ->18
         30    >   FE_FREE                                                  $18
   42    31      > JMP                                                      ->15
         32    >   FE_FREE                                                  $15
   51    33        INIT_FCALL                                               'print_r'
         34        SEND_VAR                                                 !3
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.26 ms | 1405 KiB | 17 Q