3v4l.org

run code in 500+ PHP versions simultaneously
<?php $data = json_decode('{ "list": [ { "Id": 398, "Product Title": "Banner", "Sku": "vb-13oz", "Short Description": "text", "Long Description": "text", "Cost": "0.95", "Price": "3.25", "Category": [{ "Id": 9, "Title": "Banners" }], "Attribute Sides": [{ "Id": 1, "Title": "1 Side" }], "Attribute Grommets": [ { "Id": 1, "Title": "Every 2\' All Sides" }, { "Id": 2, "Title": "Every 2\' Top and Bottom" }, { "Id": 3, "Title": "Every 2\' Left & Right" }, { "Id": 4, "Title": "4 Corners Only" }, { "Id": 5, "Title": "No Gromments" } ] } ] }', true); foreach($data['list'] as $key => $item) { $data['list'][$key]['Attribute Grommets'] = [ [ 'Id' => $item['Attribute Grommets'][0]['Id'], 'Title' => implode(' | ', array_column($item['Attribute Grommets'], 'Title')) ] ]; } echo json_encode($data, JSON_PRETTY_PRINT);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 26
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 26
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/rSHmM
function name:  (null)
number of ops:  33
compiled vars:  !0 = $data, !1 = $item, !2 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'json_decode'
          1        SEND_VAL                                                     '%7B%0A++++%22list%22%3A+%5B%0A++++++++%7B%0A++++++++++++%22Id%22%3A+398%2C%0A++++++++++++%22Product+Title%22%3A+%22Banner%22%2C%0A++++++++++++%22Sku%22%3A+%22vb-13oz%22%2C%0A++++++++++++%22Short+Description%22%3A+%22text%22%2C%0A++++++++++++%22Long+Description%22%3A+%22text%22%2C%0A++++++++++++%22Cost%22%3A+%220.95%22%2C%0A++++++++++++%22Price%22%3A+%223.25%22%2C%0A++++++++++++%22Category%22%3A+%5B%7B+%22Id%22%3A+9%2C+%22Title%22%3A+%22Banners%22+%7D%5D%2C%0A++++++++++++%22Attribute+Sides%22%3A+%5B%7B+%22Id%22%3A+1%2C+%22Title%22%3A+%221+Side%22+%7D%5D%2C%0A++++++++++++%22Attribute+Grommets%22%3A+%5B%0A++++++++++++++++%7B+%22Id%22%3A+1%2C+%22Title%22%3A+%22Every+2%27+All+Sides%22+%7D%2C%0A++++++++++++++++%7B+%22Id%22%3A+2%2C+%22Title%22%3A+%22Every+2%27+Top+and+Bottom%22+%7D%2C%0A++++++++++++++++%7B+%22Id%22%3A+3%2C+%22Title%22%3A+%22Every+2%27+Left+%26+Right%22+%7D%2C%0A++++++++++++++++%7B+%22Id%22%3A+4%2C+%22Title%22%3A+%224+Corners+Only%22+%7D%2C%0A++++++++++++++++%7B+%22Id%22%3A+5%2C+%22Title%22%3A+%22No+Gromments%22+%7D%0A++++++++++++%5D%0A++++++++%7D%0A++++%5D%0A%7D'
   24     2        SEND_VAL                                                     <true>
    3     3        DO_ICALL                                             $3      
          4        ASSIGN                                                       !0, $3
   26     5        FETCH_DIM_R                                          ~5      !0, 'list'
          6      > FE_RESET_R                                           $6      ~5, ->26
          7    > > FE_FETCH_R                                           ~7      $6, !1, ->26
          8    >   ASSIGN                                                       !2, ~7
   29     9        FETCH_DIM_R                                          ~12     !1, 'Attribute+Grommets'
         10        FETCH_DIM_R                                          ~13     ~12, 0
         11        FETCH_DIM_R                                          ~14     ~13, 'Id'
         12        INIT_ARRAY                                           ~15     ~14, 'Id'
   30    13        INIT_FCALL                                                   'array_column'
         14        FETCH_DIM_R                                          ~16     !1, 'Attribute+Grommets'
         15        SEND_VAL                                                     ~16
         16        SEND_VAL                                                     'Title'
         17        DO_ICALL                                             $17     
         18        FRAMELESS_ICALL_2                implode             ~18     '+%7C+', $17
         19        ADD_ARRAY_ELEMENT                                    ~15     ~18, 'Title'
         20        INIT_ARRAY                                           ~19     ~15
   27    21        FETCH_DIM_W                                          $9      !0, 'list'
         22        FETCH_DIM_W                                          $10     $9, !2
         23        ASSIGN_DIM                                                   $10, 'Attribute+Grommets'
   30    24        OP_DATA                                                      ~19
   26    25      > JMP                                                          ->7
         26    >   FE_FREE                                                      $6
   35    27        INIT_FCALL                                                   'json_encode'
         28        SEND_VAR                                                     !0
         29        SEND_VAL                                                     128
         30        DO_ICALL                                             $20     
         31        ECHO                                                         $20
         32      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
198.02 ms | 1694 KiB | 16 Q