3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(); $arr["Intercambio"]["0"]["Versao"]["0"] = "2"; $arr["Intercambio"]["0"]["TipoIdentificacaoRemetente"]["0"] = "cnpj"; $arr["Intercambio"]["0"]["IdentificacaoRemetente"]["0"] = "02089969001420"; $arr["TextosCodificados"]["TextoCodificado"]["0"]["QualificadorAssunto"]["0"] = "ALL"; $arr["TextosCodificados"]["TextoCodificado"]["0"]["Texto"] = "Vnd mer.adq.rec.ter.op.mer.sj.rg.sub.trb.cnd.sub.t"; $arr["TextosCodificados"]["TextoCodificado"]["1"]["QualificadorAssunto"]["0"] = "AAI"; $arr["TextosCodificados"]["TextoCodificado"]["1"]["Texto"] = "Protocolo ICMS 18809 e 1192012 ICMS Retido Art 313W"; $arr["TextosCodificados"]["TextoCodificado"]["2"]["QualificadorAssunto"]["0"] = "IVN"; $arr["TextosCodificados"]["TextoCodificado"]["2"]["Texto"] = "Pedido Interno:0000283278 ID da Carga:"; function recursive_show_array($arr, $tmp = array()) { foreach($arr as $k => $value) {var_dump(is_array($value));die; if(is_array($value)) { $tmp = recursive_show_array($value, $tmp); } else { //var_dump($value); $tmp[$k] = $value; } } return $tmp; } $rst = recursive_show_array($arr); //var_dump($rst); die; function teste($arr) { $newArr = array(); foreach( $arr as $k => $v ) { $tmp = array(); if( is_array($v) && count($v) == 1 ) { $newArr[$k] = $v; $tmp = teste($v); } elseif( is_array($v) && count($v) > 1 ) { var_dump($v); $tmp = teste($v); //$newArr = array_merge($newArr, $tmp); } } return $newArr; } $rst = teste($arr); //var_dump($rst);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/SG2bh
function name:  (null)
number of ops:  59
compiled vars:  !0 = $arr, !1 = $rst
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    7     1        FETCH_DIM_W                                      $3      !0, 'Intercambio'
          2        FETCH_DIM_W                                      $4      $3, 0
          3        FETCH_DIM_W                                      $5      $4, 'Versao'
          4        ASSIGN_DIM                                               $5, 0
          5        OP_DATA                                                  '2'
    8     6        FETCH_DIM_W                                      $7      !0, 'Intercambio'
          7        FETCH_DIM_W                                      $8      $7, 0
          8        FETCH_DIM_W                                      $9      $8, 'TipoIdentificacaoRemetente'
          9        ASSIGN_DIM                                               $9, 0
         10        OP_DATA                                                  'cnpj'
    9    11        FETCH_DIM_W                                      $11     !0, 'Intercambio'
         12        FETCH_DIM_W                                      $12     $11, 0
         13        FETCH_DIM_W                                      $13     $12, 'IdentificacaoRemetente'
         14        ASSIGN_DIM                                               $13, 0
         15        OP_DATA                                                  '02089969001420'
   11    16        FETCH_DIM_W                                      $15     !0, 'TextosCodificados'
         17        FETCH_DIM_W                                      $16     $15, 'TextoCodificado'
         18        FETCH_DIM_W                                      $17     $16, 0
         19        FETCH_DIM_W                                      $18     $17, 'QualificadorAssunto'
         20        ASSIGN_DIM                                               $18, 0
         21        OP_DATA                                                  'ALL'
   12    22        FETCH_DIM_W                                      $20     !0, 'TextosCodificados'
         23        FETCH_DIM_W                                      $21     $20, 'TextoCodificado'
         24        FETCH_DIM_W                                      $22     $21, 0
         25        ASSIGN_DIM                                               $22, 'Texto'
         26        OP_DATA                                                  'Vnd+mer.adq.rec.ter.op.mer.sj.rg.sub.trb.cnd.sub.t'
   13    27        FETCH_DIM_W                                      $24     !0, 'TextosCodificados'
         28        FETCH_DIM_W                                      $25     $24, 'TextoCodificado'
         29        FETCH_DIM_W                                      $26     $25, 1
         30        FETCH_DIM_W                                      $27     $26, 'QualificadorAssunto'
         31        ASSIGN_DIM                                               $27, 0
         32        OP_DATA                                                  'AAI'
   14    33        FETCH_DIM_W                                      $29     !0, 'TextosCodificados'
         34        FETCH_DIM_W                                      $30     $29, 'TextoCodificado'
         35        FETCH_DIM_W                                      $31     $30, 1
         36        ASSIGN_DIM                                               $31, 'Texto'
         37        OP_DATA                                                  'Protocolo+ICMS+18809+e+1192012+ICMS+Retido+Art+313W'
   15    38        FETCH_DIM_W                                      $33     !0, 'TextosCodificados'
         39        FETCH_DIM_W                                      $34     $33, 'TextoCodificado'
         40        FETCH_DIM_W                                      $35     $34, 2
         41        FETCH_DIM_W                                      $36     $35, 'QualificadorAssunto'
         42        ASSIGN_DIM                                               $36, 0
         43        OP_DATA                                                  'IVN'
   16    44        FETCH_DIM_W                                      $38     !0, 'TextosCodificados'
         45        FETCH_DIM_W                                      $39     $38, 'TextoCodificado'
         46        FETCH_DIM_W                                      $40     $39, 2
         47        ASSIGN_DIM                                               $40, 'Texto'
         48        OP_DATA                                                  'Pedido+Interno%3A0000283278+ID+da+Carga%3A'
   34    49        INIT_FCALL                                               'recursive_show_array'
         50        SEND_VAR                                                 !0
         51        DO_FCALL                                      0  $42     
         52        ASSIGN                                                   !1, $42
   37    53      > EXIT                                                     
   55    54*       INIT_FCALL                                               'teste'
         55*       SEND_VAR                                                 !0
         56*       DO_FCALL                                      0  $44     
         57*       ASSIGN                                                   !1, $44
   57    58*     > RETURN                                                   1

Function recursive_show_array:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/SG2bh
function name:  recursive_show_array
number of ops:  24
compiled vars:  !0 = $arr, !1 = $tmp, !2 = $value, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
   20     2      > FE_RESET_R                                       $4      !0, ->21
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->21
          4    >   ASSIGN                                                   !3, ~5
   21     5        INIT_FCALL                                               'var_dump'
          6        TYPE_CHECK                                  128  ~7      !2
          7        SEND_VAL                                                 ~7
          8        DO_ICALL                                                 
          9      > EXIT                                                     
   22    10*       TYPE_CHECK                                  128          !2
         11*       JMPZ                                                     ~9, ->18
   24    12*       INIT_FCALL_BY_NAME                                       'recursive_show_array'
         13*       SEND_VAR_EX                                              !2
         14*       SEND_VAR_EX                                              !1
         15*       DO_FCALL                                      0  $10     
         16*       ASSIGN                                                   !1, $10
         17*       JMP                                                      ->20
   29    18*       ASSIGN_DIM                                               !1, !3
         19*       OP_DATA                                                  !2
   20    20*       JMP                                                      ->3
         21    >   FE_FREE                                                  $4
   32    22      > RETURN                                                   !1
   33    23*     > RETURN                                                   null

End of function recursive_show_array

Function teste:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 33
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 33
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 19
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 32
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 32
Branch analysis from position: 24
Branch analysis from position: 11
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/SG2bh
function name:  teste
number of ops:  36
compiled vars:  !0 = $arr, !1 = $newArr, !2 = $v, !3 = $k, !4 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
   40     1        ASSIGN                                                   !1, <array>
   41     2      > FE_RESET_R                                       $6      !0, ->33
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->33
          4    >   ASSIGN                                                   !3, ~7
   42     5        ASSIGN                                                   !4, <array>
   43     6        TYPE_CHECK                                  128  ~10     !2
          7      > JMPZ_EX                                          ~10     ~10, ->11
          8    >   COUNT                                            ~11     !2
          9        IS_EQUAL                                         ~12     ~11, 1
         10        BOOL                                             ~10     ~12
         11    > > JMPZ                                                     ~10, ->19
   44    12    >   ASSIGN_DIM                                               !1, !3
         13        OP_DATA                                                  !2
   45    14        INIT_FCALL_BY_NAME                                       'teste'
         15        SEND_VAR_EX                                              !2
         16        DO_FCALL                                      0  $14     
         17        ASSIGN                                                   !4, $14
         18      > JMP                                                      ->32
   46    19    >   TYPE_CHECK                                  128  ~16     !2
         20      > JMPZ_EX                                          ~16     ~16, ->24
         21    >   COUNT                                            ~17     !2
         22        IS_SMALLER                                       ~18     1, ~17
         23        BOOL                                             ~16     ~18
         24    > > JMPZ                                                     ~16, ->32
   47    25    >   INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                                 
   48    28        INIT_FCALL_BY_NAME                                       'teste'
         29        SEND_VAR_EX                                              !2
         30        DO_FCALL                                      0  $20     
         31        ASSIGN                                                   !4, $20
   41    32    > > JMP                                                      ->3
         33    >   FE_FREE                                                  $6
   52    34      > RETURN                                                   !1
   53    35*     > RETURN                                                   null

End of function teste

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.24 ms | 1411 KiB | 17 Q