3v4l.org

run code in 300+ PHP versions simultaneously
<?php function printArrayStructureTest($array, $output, $breadcrumb = array()) { if(!empty($array)) { $output .= '$this->assertCount('; $output .= count($array); $output .= ', '; if(empty($breadcrumb)) { $output .= '$response'; } else { $output .= '$response[\''; $output .= implode('\'][\'', $breadcrumb); $output .= '\']'; } $output .= "\n"; foreach($array as $key => $value) { $output .= '$this->assertArrayHasKey('; $output .= "'" . $key . "'"; $output .= ', '; if(empty($breadcrumb)) { $output .= '$response'; } else { $output .= '$response[\''; $output .= implode('\'][\'', $breadcrumb); $output .= '\']'; } $output .= "\n"; if(is_array($value)) { $breadcrumb[] = $key; $this->printArrayStructureTest($value, $output); } } } return $output; } $list = array( 'transport' => array( 'plane' => array( 'boeing', 'airbus', ), 'car' => array( 'audi', 'ford' ), ), ); printArrayStructureTest($list, "");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BPZv1
function name:  (null)
number of ops:  6
compiled vars:  !0 = $list
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   ASSIGN                                                   !0, <array>
   61     1        INIT_FCALL                                               'printarraystructuretest'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 ''
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Function printarraystructuretest:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 53
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 52
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 52
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 51
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 51
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 51
Branch analysis from position: 44
Branch analysis from position: 51
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
Branch analysis from position: 14
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 52
Branch analysis from position: 23
Branch analysis from position: 52
Branch analysis from position: 53
filename:       /in/BPZv1
function name:  printArrayStructureTest
number of ops:  55
compiled vars:  !0 = $array, !1 = $output, !2 = $breadcrumb, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <array>
    5     3        ISSET_ISEMPTY_CV                                 ~5      !0
          4        BOOL_NOT                                         ~6      ~5
          5      > JMPZ                                                     ~6, ->53
    7     6    >   ASSIGN_OP                                     8          !1, '%24this-%3EassertCount%28'
    8     7        COUNT                                            ~8      !0
          8        ASSIGN_OP                                     8          !1, ~8
    9     9        ASSIGN_OP                                     8          !1, '%2C+'
   10    10        ISSET_ISEMPTY_CV                                         !2
         11      > JMPZ                                                     ~11, ->14
   12    12    >   ASSIGN_OP                                     8          !1, '%24response'
         13      > JMP                                                      ->21
   16    14    >   ASSIGN_OP                                     8          !1, '%24response%5B%27'
   17    15        INIT_FCALL                                               'implode'
         16        SEND_VAL                                                 '%27%5D%5B%27'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                         $14     
         19        ASSIGN_OP                                     8          !1, $14
   18    20        ASSIGN_OP                                     8          !1, '%27%5D'
   20    21    >   ASSIGN_OP                                     8          !1, '%0A'
   22    22      > FE_RESET_R                                       $18     !0, ->52
         23    > > FE_FETCH_R                                       ~19     $18, !3, ->52
         24    >   ASSIGN                                                   !4, ~19
   24    25        ASSIGN_OP                                     8          !1, '%24this-%3EassertArrayHasKey%28'
   25    26        CONCAT                                           ~22     '%27', !4
         27        CONCAT                                           ~23     ~22, '%27'
         28        ASSIGN_OP                                     8          !1, ~23
   26    29        ASSIGN_OP                                     8          !1, '%2C+'
   27    30        ISSET_ISEMPTY_CV                                         !2
         31      > JMPZ                                                     ~26, ->34
   29    32    >   ASSIGN_OP                                     8          !1, '%24response'
         33      > JMP                                                      ->41
   33    34    >   ASSIGN_OP                                     8          !1, '%24response%5B%27'
   34    35        INIT_FCALL                                               'implode'
         36        SEND_VAL                                                 '%27%5D%5B%27'
         37        SEND_VAR                                                 !2
         38        DO_ICALL                                         $29     
         39        ASSIGN_OP                                     8          !1, $29
   35    40        ASSIGN_OP                                     8          !1, '%27%5D'
   37    41    >   ASSIGN_OP                                     8          !1, '%0A'
   38    42        TYPE_CHECK                                  128          !3
         43      > JMPZ                                                     ~33, ->51
   40    44    >   ASSIGN_DIM                                               !2
         45        OP_DATA                                                  !4
   41    46        FETCH_THIS                                       $35     
         47        INIT_METHOD_CALL                                         $35, 'printArrayStructureTest'
         48        SEND_VAR_EX                                              !3
         49        SEND_VAR_EX                                              !1
         50        DO_FCALL                                      0          
   22    51    > > JMP                                                      ->23
         52    >   FE_FREE                                                  $18
   45    53    > > RETURN                                                   !1
   46    54*     > RETURN                                                   null

End of function printarraystructuretest

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.31 ms | 1403 KiB | 16 Q