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 = []; $root .= ($root == '' ? '' : '-'); 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/PkBYK
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>
   51     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 = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 29
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 29
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 25
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 29
Branch analysis from position: 10
Branch analysis from position: 29
filename:       /in/PkBYK
function name:  simplify
number of ops:  32
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        IS_EQUAL                                                     !1, ''
          4      > JMPZ                                                         ~6, ->7
          5    >   QM_ASSIGN                                            ~7      ''
          6      > JMP                                                          ->8
          7    >   QM_ASSIGN                                            ~7      '-'
          8    >   ASSIGN_OP                                         8          !1, ~7
   41     9      > FE_RESET_R                                           $9      !0, ->29
         10    > > FE_FETCH_R                                           ~10     $9, !3, ->29
         11    >   ASSIGN                                                       !4, ~10
   42    12        TYPE_CHECK                                      128          !3
         13      > JMPZ                                                         ~12, ->25
   43    14    >   INIT_FCALL                                                   'array_merge'
         15        SEND_VAR                                                     !2
         16        INIT_FCALL_BY_NAME                                           'simplify'
         17        SEND_VAR_EX                                                  !3
         18        CONCAT                                               ~13     !1, !4
         19        SEND_VAL_EX                                                  ~13
         20        DO_FCALL                                          0  $14     
         21        SEND_VAR                                                     $14
         22        DO_ICALL                                             $15     
         23        ASSIGN                                                       !2, $15
   42    24      > JMP                                                          ->28
   45    25    >   CONCAT                                               ~17     !1, !3
         26        ASSIGN_DIM                                                   !2, ~17
         27        OP_DATA                                                      1
   41    28    > > JMP                                                          ->10
         29    >   FE_FREE                                                      $9
   48    30      > RETURN                                                       !2
   49    31*     > RETURN                                                       null

End of function simplify

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.03 ms | 2114 KiB | 16 Q