3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "type": "the type", "typesm": "type of", "entries": [ { "title": "title one", "body": "Original text", "image": "image 1 url", "time": "1558532690", "meta": { "mainColor": "#100a0e", "adSpace": null } }, { "title": "title two", "body": "Original text", "image": "image 1 url", "time": "1558515409", "meta": { "mainColor": "#100a0e", "adSpace": null } }]}'; $arr = json_decode($json, true); $arr['entries'] = array_column($arr['entries'], null, 'body'); foreach ($arr['entries'] as $ent){ echo $ent['image']. "\n"; echo $ent['title']. "\n"; echo $ent['body']. "\n"; } unset($ent); Echo "\n\n\n"; $arr = json_decode($json, true); foreach($arr['entries'] as $e){ $ent[$e['body'] . " " . $e['image']] = $e; } //$ent is now the new array with unique values of 'entries' foreach ($ent as $e){ echo $e['image'] . "\n"; echo $e['title'] . "\n"; echo $e['body'] . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 27
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 27
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 27
2 jumps found. (Code = 77) Position 1 = 37, Position 2 = 45
Branch analysis from position: 37
2 jumps found. (Code = 78) Position 1 = 38, Position 2 = 45
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 45
2 jumps found. (Code = 77) Position 1 = 47, Position 2 = 58
Branch analysis from position: 47
2 jumps found. (Code = 78) Position 1 = 48, Position 2 = 58
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
Branch analysis from position: 45
Branch analysis from position: 27
filename:       /in/hdP0h
function name:  (null)
number of ops:  60
compiled vars:  !0 = $json, !1 = $arr, !2 = $ent, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%0A++%22type%22%3A+%22the+type%22%2C%0A++%22typesm%22%3A+%22type+of%22%2C%0A++%22entries%22%3A+%5B%0A++++%7B%0A++++++%22title%22%3A+%22title+one%22%2C%0A++++++%22body%22%3A+%22Original+text%22%2C%0A++++++%22image%22%3A+%22image+1+url%22%2C%0A++++++%22time%22%3A+%221558532690%22%2C%0A++++++%22meta%22%3A+%7B%0A++++++++%22mainColor%22%3A+%22%23100a0e%22%2C%0A++++++++%22adSpace%22%3A+null%0A++++++%7D%0A++++%7D%2C%0A++++%7B%0A++++++%22title%22%3A+%22title+two%22%2C%0A++++++%22body%22%3A+%22Original+text%22%2C%0A++++++%22image%22%3A+%22image+1+url%22%2C%0A++++++%22time%22%3A+%221558515409%22%2C%0A++++++%22meta%22%3A+%7B%0A++++++++%22mainColor%22%3A+%22%23100a0e%22%2C%0A++++++++%22adSpace%22%3A+null%0A++++++%7D%0A++++%7D%5D%7D'
   27     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
   28     6        INIT_FCALL                                               'array_column'
          7        FETCH_DIM_R                                      ~8      !1, 'entries'
          8        SEND_VAL                                                 ~8
          9        SEND_VAL                                                 null
         10        SEND_VAL                                                 'body'
         11        DO_ICALL                                         $9      
         12        ASSIGN_DIM                                               !1, 'entries'
         13        OP_DATA                                                  $9
   31    14        FETCH_DIM_R                                      ~10     !1, 'entries'
         15      > FE_RESET_R                                       $11     ~10, ->27
         16    > > FE_FETCH_R                                               $11, !2, ->27
   32    17    >   FETCH_DIM_R                                      ~12     !2, 'image'
         18        CONCAT                                           ~13     ~12, '%0A'
         19        ECHO                                                     ~13
   33    20        FETCH_DIM_R                                      ~14     !2, 'title'
         21        CONCAT                                           ~15     ~14, '%0A'
         22        ECHO                                                     ~15
   34    23        FETCH_DIM_R                                      ~16     !2, 'body'
         24        CONCAT                                           ~17     ~16, '%0A'
         25        ECHO                                                     ~17
   31    26      > JMP                                                      ->16
         27    >   FE_FREE                                                  $11
   37    28        UNSET_CV                                                 !2
   38    29        ECHO                                                     '%0A%0A%0A'
   40    30        INIT_FCALL                                               'json_decode'
         31        SEND_VAR                                                 !0
         32        SEND_VAL                                                 <true>
         33        DO_ICALL                                         $18     
         34        ASSIGN                                                   !1, $18
   41    35        FETCH_DIM_R                                      ~20     !1, 'entries'
         36      > FE_RESET_R                                       $21     ~20, ->45
         37    > > FE_FETCH_R                                               $21, !3, ->45
   42    38    >   FETCH_DIM_R                                      ~22     !3, 'body'
         39        CONCAT                                           ~23     ~22, '+'
         40        FETCH_DIM_R                                      ~24     !3, 'image'
         41        CONCAT                                           ~25     ~23, ~24
         42        ASSIGN_DIM                                               !2, ~25
         43        OP_DATA                                                  !3
   41    44      > JMP                                                      ->37
         45    >   FE_FREE                                                  $21
   46    46      > FE_RESET_R                                       $27     !2, ->58
         47    > > FE_FETCH_R                                               $27, !3, ->58
   47    48    >   FETCH_DIM_R                                      ~28     !3, 'image'
         49        CONCAT                                           ~29     ~28, '%0A'
         50        ECHO                                                     ~29
   48    51        FETCH_DIM_R                                      ~30     !3, 'title'
         52        CONCAT                                           ~31     ~30, '%0A'
         53        ECHO                                                     ~31
   49    54        FETCH_DIM_R                                      ~32     !3, 'body'
         55        CONCAT                                           ~33     ~32, '%0A'
         56        ECHO                                                     ~33
   46    57      > JMP                                                      ->47
         58    >   FE_FREE                                                  $27
   50    59      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
133.92 ms | 1405 KiB | 17 Q