3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr=array( array( array(array( "value1", "value2" ), "value2" ), array( "value3", "value4" ) ), array( array( "value5", "value6" ), array( "value7", "value8" ) ) ); var_debug($arr); function var_debug($variable,$strlen=100,$width=25,$depth=10,$i=0,&$objects = array()) { $search = array("\0", "\a", "\b", "\f", "\n", "\r", "\t", "\v"); $replace = array('\0', '\a', '\b', '\f', '\n', '\r', '\t', '\v'); $string = ''; switch(gettype($variable)) { case 'boolean': $string.= $variable?'true':'false'; break; case 'integer': $string.= $variable; break; case 'double': $string.= $variable; break; case 'resource': $string.= '[resource]'; break; case 'NULL': $string.= "null"; break; case 'unknown type': $string.= '???'; break; case 'string': $len = strlen($variable); $variable = str_replace($search,$replace,substr($variable,0,$strlen),$count); $variable = substr($variable,0,$strlen); if ($len<$strlen) $string.= '"'.$variable.'"'; else $string.= 'string('.$len.'): "'.$variable.'"...'; break; case 'array': $len = count($variable); if ($i==$depth) $string.= 'array('.$len.') {...}'; elseif(!$len) $string.= 'array(0) {}'; else { $keys = array_keys($variable); $spaces = str_repeat(' ',$i*2); $string.= "array($len)\n".$spaces.'{'; $count=0; foreach($keys as $key) { if ($count==$width) { $string.= "\n".$spaces." ..."; break; } $string.= "\n".$spaces." [$key] => "; $string.= var_debug($variable[$key],$strlen,$width,$depth,$i+1,$objects); $count++; } $string.="\n".$spaces.'}'; } break; case 'object': $id = array_search($variable,$objects,true); if ($id!==false) $string.=get_class($variable).'#'.($id+1).' {...}'; else if($i==$depth) $string.=get_class($variable).' {...}'; else { $id = array_push($objects,$variable); $array = (array)$variable; $spaces = str_repeat(' ',$i*2); $string.= get_class($variable)."#$id\n".$spaces.'{'; $properties = array_keys($array); foreach($properties as $property) { $name = str_replace("\0",':',trim($property)); $string.= "\n".$spaces." [$name] => "; $string.= var_debug($array[$property],$strlen,$width,$depth,$i+1,$objects); } $string.= "\n".$spaces.'}'; } break; } if ($i>0) return $string; $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); do $caller = array_shift($backtrace); while ($caller && !isset($caller['file'])); if ($caller) $string = $caller['file'].':'.$caller['line']."\n".$string; echo $string; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aCmrD
function name:  (null)
number of ops:  5
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        INIT_FCALL_BY_NAME                                       'var_debug'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   87     4      > RETURN                                                   1

Function var_debug:
Finding entry points
Branch analysis from position: 0
11 jumps found. (Code = 188) Position 1 = 30, Position 2 = 36, Position 3 = 38, Position 4 = 40, Position 5 = 42, Position 6 = 44, Position 7 = 46, Position 8 = 78, Position 9 = 140, Position 10 = 221, Position 11 = 11
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 221
Branch analysis from position: 221
2 jumps found. (Code = 43) Position 1 = 224, Position 2 = 225
Branch analysis from position: 224
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 225
2 jumps found. (Code = 46) Position 1 = 234, Position 2 = 237
Branch analysis from position: 234
2 jumps found. (Code = 44) Position 1 = 238, Position 2 = 229
Branch analysis from position: 238
2 jumps found. (Code = 43) Position 1 = 239, Position 2 = 246
Branch analysis from position: 239
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 246
Branch analysis from position: 229
Branch analysis from position: 237
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 221
Branch analysis from position: 221
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 221
Branch analysis from position: 221
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 221
Branch analysis from position: 221
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 221
Branch analysis from position: 221
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 221
Branch analysis from position: 221
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 221
Branch analysis from position: 221
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 72
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 77
Branch analysis from position: 77
1 jumps found. (Code = 42) Position 1 = 221
Branch analysis from position: 221
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 221
Branch analysis from position: 221
Branch analysis from position: 78
2 jumps found. (Code = 43) Position 1 = 82, Position 2 = 86
Branch analysis from position: 82
1 jumps found. (Code = 42) Position 1 = 139
Branch analysis from position: 139
1 jumps found. (Code = 42) Position 1 = 221
Branch analysis from position: 221
Branch analysis from position: 86
2 jumps found. (Code = 43) Position 1 = 88, Position 2 = 90
Branch analysis from position: 88
1 jumps found. (Code = 42) Position 1 = 139
Branch analysis from position: 139
Branch analysis from position: 90
2 jumps found. (Code = 77) Position 1 = 108, Position 2 = 135
Branch analysis from position: 108
2 jumps found. (Code = 78) Position 1 = 109, Position 2 = 135
Branch analysis from position: 109
2 jumps found. (Code = 43) Position 1 = 111, Position 2 = 115
Branch analysis from position: 111
1 jumps found. (Code = 42) Position 1 = 135
Branch analysis from position: 135
1 jumps found. (Code = 42) Position 1 = 221
Branch analysis from position: 221
Branch analysis from position: 115
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
Branch analysis from position: 135
Branch analysis from position: 135
Branch analysis from position: 140
2 jumps found. (Code = 43) Position 1 = 148, Position 2 = 155
Branch analysis from position: 148
1 jumps found. (Code = 42) Position 1 = 220
Branch analysis from position: 220
1 jumps found. (Code = 42) Position 1 = 221
Branch analysis from position: 221
Branch analysis from position: 155
2 jumps found. (Code = 43) Position 1 = 157, Position 2 = 161
Branch analysis from position: 157
1 jumps found. (Code = 42) Position 1 = 220
Branch analysis from position: 220
Branch analysis from position: 161
2 jumps found. (Code = 77) Position 1 = 187, Position 2 = 216
Branch analysis from position: 187
2 jumps found. (Code = 78) Position 1 = 188, Position 2 = 216
Branch analysis from position: 188
1 jumps found. (Code = 42) Position 1 = 187
Branch analysis from position: 187
Branch analysis from position: 216
1 jumps found. (Code = 42) Position 1 = 221
Branch analysis from position: 221
Branch analysis from position: 216
Branch analysis from position: 221
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 30
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 36
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 38
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 40
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 42
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 44
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 46
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 78
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 140
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 221
Branch analysis from position: 221
Branch analysis from position: 140
Branch analysis from position: 78
Branch analysis from position: 46
Branch analysis from position: 44
Branch analysis from position: 42
Branch analysis from position: 40
Branch analysis from position: 38
Branch analysis from position: 36
Branch analysis from position: 30
filename:       /in/aCmrD
function name:  var_debug
number of ops:  248
compiled vars:  !0 = $variable, !1 = $strlen, !2 = $width, !3 = $depth, !4 = $i, !5 = $objects, !6 = $search, !7 = $replace, !8 = $string, !9 = $len, !10 = $count, !11 = $keys, !12 = $spaces, !13 = $key, !14 = $id, !15 = $array, !16 = $properties, !17 = $property, !18 = $name, !19 = $backtrace, !20 = $caller
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      100
          2        RECV_INIT                                        !2      25
          3        RECV_INIT                                        !3      10
          4        RECV_INIT                                        !4      0
          5        RECV_INIT                                        !5      <array>
   18     6        ASSIGN                                                   !6, <array>
   19     7        ASSIGN                                                   !7, <array>
   21     8        ASSIGN                                                   !8, ''
   23     9        GET_TYPE                                         ~24     !0
         10      > SWITCH_STRING                                            ~24, [ 'boolean':->30, 'integer':->36, 'double':->38, 'resource':->40, 'NULL':->42, 'unknown+type':->44, 'string':->46, 'array':->78, 'object':->140, ], ->221
   24    11    >   CASE                                                     ~24, 'boolean'
         12      > JMPNZ                                                    ~25, ->30
   25    13    >   CASE                                                     ~24, 'integer'
         14      > JMPNZ                                                    ~25, ->36
   26    15    >   CASE                                                     ~24, 'double'
         16      > JMPNZ                                                    ~25, ->38
   27    17    >   CASE                                                     ~24, 'resource'
         18      > JMPNZ                                                    ~25, ->40
   28    19    >   CASE                                                     ~24, 'NULL'
         20      > JMPNZ                                                    ~25, ->42
   29    21    >   CASE                                                     ~24, 'unknown+type'
         22      > JMPNZ                                                    ~25, ->44
   30    23    >   CASE                                                     ~24, 'string'
         24      > JMPNZ                                                    ~25, ->46
   37    25    >   CASE                                                     ~24, 'array'
         26      > JMPNZ                                                    ~25, ->78
   58    27    >   CASE                                                     ~24, 'object'
         28      > JMPNZ                                                    ~25, ->140
         29    > > JMP                                                      ->221
   24    30    > > JMPZ                                                     !0, ->33
         31    >   QM_ASSIGN                                        ~26     'true'
         32      > JMP                                                      ->34
         33    >   QM_ASSIGN                                        ~26     'false'
         34    >   ASSIGN_OP                                     8          !8, ~26
         35      > JMP                                                      ->221
   25    36    >   ASSIGN_OP                                     8          !8, !0
         37      > JMP                                                      ->221
   26    38    >   ASSIGN_OP                                     8          !8, !0
         39      > JMP                                                      ->221
   27    40    >   ASSIGN_OP                                     8          !8, '%5Bresource%5D'
         41      > JMP                                                      ->221
   28    42    >   ASSIGN_OP                                     8          !8, 'null'
         43      > JMP                                                      ->221
   29    44    >   ASSIGN_OP                                     8          !8, '%3F%3F%3F'
         45      > JMP                                                      ->221
   31    46    >   STRLEN                                           ~33     !0
         47        ASSIGN                                                   !9, ~33
   32    48        INIT_FCALL                                               'str_replace'
         49        SEND_VAR                                                 !6
         50        SEND_VAR                                                 !7
         51        INIT_FCALL                                               'substr'
         52        SEND_VAR                                                 !0
         53        SEND_VAL                                                 0
         54        SEND_VAR                                                 !1
         55        DO_ICALL                                         $35     
         56        SEND_VAR                                                 $35
         57        SEND_REF                                                 !10
         58        DO_ICALL                                         $36     
         59        ASSIGN                                                   !0, $36
   33    60        INIT_FCALL                                               'substr'
         61        SEND_VAR                                                 !0
         62        SEND_VAL                                                 0
         63        SEND_VAR                                                 !1
         64        DO_ICALL                                         $38     
         65        ASSIGN                                                   !0, $38
   34    66        IS_SMALLER                                               !9, !1
         67      > JMPZ                                                     ~40, ->72
         68    >   CONCAT                                           ~41     '%22', !0
         69        CONCAT                                           ~42     ~41, '%22'
         70        ASSIGN_OP                                     8          !8, ~42
         71      > JMP                                                      ->77
   35    72    >   CONCAT                                           ~44     'string%28', !9
         73        CONCAT                                           ~45     ~44, '%29%3A+%22'
         74        CONCAT                                           ~46     ~45, !0
         75        CONCAT                                           ~47     ~46, '%22...'
         76        ASSIGN_OP                                     8          !8, ~47
   36    77    > > JMP                                                      ->221
   38    78    >   COUNT                                            ~49     !0
         79        ASSIGN                                                   !9, ~49
   39    80        IS_EQUAL                                                 !4, !3
         81      > JMPZ                                                     ~51, ->86
         82    >   CONCAT                                           ~52     'array%28', !9
         83        CONCAT                                           ~53     ~52, '%29+%7B...%7D'
         84        ASSIGN_OP                                     8          !8, ~53
         85      > JMP                                                      ->139
   40    86    >   BOOL_NOT                                         ~55     !9
         87      > JMPZ                                                     ~55, ->90
         88    >   ASSIGN_OP                                     8          !8, 'array%280%29+%7B%7D'
         89      > JMP                                                      ->139
   42    90    >   INIT_FCALL                                               'array_keys'
         91        SEND_VAR                                                 !0
         92        DO_ICALL                                         $57     
         93        ASSIGN                                                   !11, $57
   43    94        INIT_FCALL                                               'str_repeat'
         95        SEND_VAL                                                 '+'
         96        MUL                                              ~59     !4, 2
         97        SEND_VAL                                                 ~59
         98        DO_ICALL                                         $60     
         99        ASSIGN                                                   !12, $60
   44   100        ROPE_INIT                                     3  ~63     'array%28'
        101        ROPE_ADD                                      1  ~63     ~63, !9
        102        ROPE_END                                      2  ~62     ~63, '%29%0A'
        103        CONCAT                                           ~65     ~62, !12
        104        CONCAT                                           ~66     ~65, '%7B'
        105        ASSIGN_OP                                     8          !8, ~66
   45   106        ASSIGN                                                   !10, 0
   46   107      > FE_RESET_R                                       $69     !11, ->135
        108    > > FE_FETCH_R                                               $69, !13, ->135
   47   109    >   IS_EQUAL                                                 !10, !2
        110      > JMPZ                                                     ~70, ->115
   48   111    >   CONCAT                                           ~71     '%0A', !12
        112        CONCAT                                           ~72     ~71, '++...'
        113        ASSIGN_OP                                     8          !8, ~72
   49   114      > JMP                                                      ->135
   51   115    >   CONCAT                                           ~74     '%0A', !12
        116        ROPE_INIT                                     3  ~76     '++%5B'
        117        ROPE_ADD                                      1  ~76     ~76, !13
        118        ROPE_END                                      2  ~75     ~76, '%5D+%3D%3E+'
        119        CONCAT                                           ~78     ~74, ~75
        120        ASSIGN_OP                                     8          !8, ~78
   52   121        INIT_FCALL_BY_NAME                                       'var_debug'
        122        CHECK_FUNC_ARG                                           
        123        FETCH_DIM_FUNC_ARG                               $80     !0, !13
        124        SEND_FUNC_ARG                                            $80
        125        SEND_VAR_EX                                              !1
        126        SEND_VAR_EX                                              !2
        127        SEND_VAR_EX                                              !3
        128        ADD                                              ~81     !4, 1
        129        SEND_VAL_EX                                              ~81
        130        SEND_VAR_EX                                              !5
        131        DO_FCALL                                      0  $82     
        132        ASSIGN_OP                                     8          !8, $82
   53   133        PRE_INC                                                  !10
   46   134      > JMP                                                      ->108
        135    >   FE_FREE                                                  $69
   55   136        CONCAT                                           ~85     '%0A', !12
        137        CONCAT                                           ~86     ~85, '%7D'
        138        ASSIGN_OP                                     8          !8, ~86
   57   139    > > JMP                                                      ->221
   59   140    >   INIT_FCALL                                               'array_search'
        141        SEND_VAR                                                 !0
        142        SEND_VAR                                                 !5
        143        SEND_VAL                                                 <true>
        144        DO_ICALL                                         $88     
        145        ASSIGN                                                   !14, $88
   60   146        TYPE_CHECK                                  1018          !14
        147      > JMPZ                                                     ~90, ->155
   61   148    >   GET_CLASS                                        ~91     !0
        149        CONCAT                                           ~92     ~91, '%23'
        150        ADD                                              ~93     !14, 1
        151        CONCAT                                           ~94     ~92, ~93
        152        CONCAT                                           ~95     ~94, '+%7B...%7D'
        153        ASSIGN_OP                                     8          !8, ~95
   60   154      > JMP                                                      ->220
   62   155    >   IS_EQUAL                                                 !4, !3
        156      > JMPZ                                                     ~97, ->161
   63   157    >   GET_CLASS                                        ~98     !0
        158        CONCAT                                           ~99     ~98, '+%7B...%7D'
        159        ASSIGN_OP                                     8          !8, ~99
   62   160      > JMP                                                      ->220
   65   161    >   INIT_FCALL                                               'array_push'
        162        SEND_REF                                                 !5
        163        SEND_VAR                                                 !0
        164        DO_ICALL                                         $101    
        165        ASSIGN                                                   !14, $101
   66   166        CAST                                          7  ~103    !0
        167        ASSIGN                                                   !15, ~103
   67   168        INIT_FCALL                                               'str_repeat'
        169        SEND_VAL                                                 '+'
        170        MUL                                              ~105    !4, 2
        171        SEND_VAL                                                 ~105
        172        DO_ICALL                                         $106    
        173        ASSIGN                                                   !12, $106
   68   174        GET_CLASS                                        ~108    !0
        175        ROPE_INIT                                     3  ~110    '%23'
        176        ROPE_ADD                                      1  ~110    ~110, !14
        177        ROPE_END                                      2  ~109    ~110, '%0A'
        178        CONCAT                                           ~112    ~108, ~109
        179        CONCAT                                           ~113    ~112, !12
        180        CONCAT                                           ~114    ~113, '%7B'
        181        ASSIGN_OP                                     8          !8, ~114
   69   182        INIT_FCALL                                               'array_keys'
        183        SEND_VAR                                                 !15
        184        DO_ICALL                                         $116    
        185        ASSIGN                                                   !16, $116
   70   186      > FE_RESET_R                                       $118    !16, ->216
        187    > > FE_FETCH_R                                               $118, !17, ->216
   71   188    >   INIT_FCALL                                               'str_replace'
        189        SEND_VAL                                                 '%00'
        190        SEND_VAL                                                 '%3A'
        191        INIT_FCALL                                               'trim'
        192        SEND_VAR                                                 !17
        193        DO_ICALL                                         $119    
        194        SEND_VAR                                                 $119
        195        DO_ICALL                                         $120    
        196        ASSIGN                                                   !18, $120
   72   197        CONCAT                                           ~122    '%0A', !12
        198        ROPE_INIT                                     3  ~124    '++%5B'
        199        ROPE_ADD                                      1  ~124    ~124, !18
        200        ROPE_END                                      2  ~123    ~124, '%5D+%3D%3E+'
        201        CONCAT                                           ~126    ~122, ~123
        202        ASSIGN_OP                                     8          !8, ~126
   73   203        INIT_FCALL_BY_NAME                                       'var_debug'
        204        CHECK_FUNC_ARG                                           
        205        FETCH_DIM_FUNC_ARG                               $128    !15, !17
        206        SEND_FUNC_ARG                                            $128
        207        SEND_VAR_EX                                              !1
        208        SEND_VAR_EX                                              !2
        209        SEND_VAR_EX                                              !3
        210        ADD                                              ~129    !4, 1
        211        SEND_VAL_EX                                              ~129
        212        SEND_VAR_EX                                              !5
        213        DO_FCALL                                      0  $130    
        214        ASSIGN_OP                                     8          !8, $130
   70   215      > JMP                                                      ->187
        216    >   FE_FREE                                                  $118
   75   217        CONCAT                                           ~132    '%0A', !12
        218        CONCAT                                           ~133    ~132, '%7D'
        219        ASSIGN_OP                                     8          !8, ~133
   77   220    > > JMP                                                      ->221
        221    >   FREE                                                     ~24
   80   222        IS_SMALLER                                               0, !4
        223      > JMPZ                                                     ~135, ->225
        224    > > RETURN                                                   !8
   82   225    >   INIT_FCALL                                               'debug_backtrace'
        226        SEND_VAL                                                 2
        227        DO_ICALL                                         $136    
        228        ASSIGN                                                   !19, $136
   83   229    >   INIT_FCALL                                               'array_shift'
        230        SEND_REF                                                 !19
        231        DO_ICALL                                         $138    
        232        ASSIGN                                                   !20, $138
        233      > JMPZ_EX                                          ~140    !20, ->237
        234    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~141    !20, 'file'
        235        BOOL_NOT                                         ~142    ~141
        236        BOOL                                             ~140    ~142
        237    > > JMPNZ                                                    ~140, ->229
   84   238    > > JMPZ                                                     !20, ->246
        239    >   FETCH_DIM_R                                      ~143    !20, 'file'
        240        CONCAT                                           ~144    ~143, '%3A'
        241        FETCH_DIM_R                                      ~145    !20, 'line'
        242        CONCAT                                           ~146    ~144, ~145
        243        CONCAT                                           ~147    ~146, '%0A'
        244        CONCAT                                           ~148    ~147, !8
        245        ASSIGN                                                   !8, ~148
   86   246    >   ECHO                                                     !8
   87   247      > RETURN                                                   null

End of function var_debug

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.77 ms | 1039 KiB | 22 Q