3v4l.org

run code in 500+ PHP versions simultaneously
<?php $columns=[ 'id', 'snippet'=>[ 'publishedAt', 'channelId', 'channelTitle', 'description', 'thumbnails'=>[ 'default'=>['url','width','height'], 'medium'=>['url','width','height'], 'high'=>['url','width','height'], 'standard'=>['url','width','height'], 'maxres'=>['url','width','height'] ], 'tags', 'categoryId' ], 'status'=>[ 'uploadStatus', 'privacyStatus', 'license', 'embeddable', 'publicStatsViewable', 'madeForKids' ], 'statistics'=>[ 'viewCount', 'likeCount', 'favoriteCount', 'commentCount' ] ]; function simplify($columns, $root = '') { $output = []; foreach ($columns as $key => $value) { if (is_array($value)) { $output = array_merge($output, simplify($value, $root . $key . '-')); } else { $output[$root . $value] = 1; } } return $output; } var_export(simplify($columns));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MCvPl
function name:  (null)
number of ops:  8
compiled vars:  !0 = $columns
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   50     1        INIT_FCALL                                                   'var_export'
          2        INIT_FCALL                                                   'simplify'
          3        SEND_VAR                                                     !0
          4        DO_FCALL                                          0  $2      
          5        SEND_VAR                                                     $2
          6        DO_ICALL                                                     
          7      > RETURN                                                       1

Function simplify:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 24
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/MCvPl
function name:  simplify
number of ops:  27
compiled vars:  !0 = $columns, !1 = $root, !2 = $output, !3 = $value, !4 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   37     0  E >   RECV                                                 !0      
          1        RECV_INIT                                            !1      ''
   39     2        ASSIGN                                                       !2, <array>
   40     3      > FE_RESET_R                                           $6      !0, ->24
          4    > > FE_FETCH_R                                           ~7      $6, !3, ->24
          5    >   ASSIGN                                                       !4, ~7
   41     6        TYPE_CHECK                                      128          !3
          7      > JMPZ                                                         ~9, ->20
   42     8    >   INIT_FCALL                                                   'array_merge'
          9        SEND_VAR                                                     !2
         10        INIT_FCALL_BY_NAME                                           'simplify'
         11        SEND_VAR_EX                                                  !3
         12        CONCAT                                               ~10     !1, !4
         13        CONCAT                                               ~11     ~10, '-'
         14        SEND_VAL_EX                                                  ~11
         15        DO_FCALL                                          0  $12     
         16        SEND_VAR                                                     $12
         17        DO_ICALL                                             $13     
         18        ASSIGN                                                       !2, $13
   41    19      > JMP                                                          ->23
   44    20    >   CONCAT                                               ~15     !1, !3
         21        ASSIGN_DIM                                                   !2, ~15
         22        OP_DATA                                                      1
   40    23    > > JMP                                                          ->4
         24    >   FE_FREE                                                      $6
   47    25      > RETURN                                                       !2
   48    26*     > RETURN                                                       null

End of function simplify

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.94 ms | 2114 KiB | 16 Q