3v4l.org

run code in 300+ PHP versions simultaneously
<?php function debug($variable) { ob_start(); var_dump($variable); $output = ob_get_clean(); $maps = [ 'string' => "/(string\((?P<length>\d+)\)) (?P<value>\"(?<!\\\).*\")/i", 'array' => "/\[\"(?P<key>.+)\"(?:\:\"(?P<class>[a-z0-9_\\\]+)\")?(?:\:(?P<scope>public|protected|private))?\]=>/Ui", 'countable' => "/(?P<type>array|int|string)\((?P<count>\d+)\)/", 'resource' => "/resource\((?P<count>\d+)\) of type \((?P<class>[a-z0-9_\\\]+)\)/", 'bool' => "/bool\((?P<value>true|false)\)/", 'float' => "/float\((?P<value>[0-9\.]+)\)/", 'object' => "/object\((?P<class>\S+)\)\#(?P<id>\d+) \((?P<count>\d+)\)/i" ]; foreach ($maps as $function => $pattern) { $output = preg_replace_callback($pattern, function ($matches) use ($function) { switch ($function) { case 'string': $matches['value'] = htmlspecialchars($matches['value']); return '<span style="color: #0000FF;">string</span>(<span style="color: #1287DB;">' . $matches['length'] . ')</span> <span style="color: #6B6E6E;">' . $matches['value'] . '</span>'; case 'array': $key = '<span style="color: #008000;">"' . $matches['key'] . '"</span>'; $class = ''; $scope = ''; if (isset($matches['class']) && !empty($matches['class'])) { $class = ':<span style="color: #4D5D94;">"' . $matches['class'] . '"</span>'; } if (isset($matches['scope']) && !empty($matches['scope'])) { $scope = ':<span style="color: #666666;">' . $matches['scope'] . '</span>'; } return '[' . $key . $class . $scope . ']=>'; case 'countable': $type = '<span style="color: #0000FF;">' . $matches['type'] . '</span>'; $count = '(<span style="color: #1287DB;">' . $matches['count'] . '</span>)'; return $type . $count; case 'bool': return '<span style="color: #0000FF;">bool</span>(<span style="color: #0000FF;">' . $matches['value'] . '</span>)'; case 'float': return '<span style="color: #0000FF;">float</span>(<span style="color: #1287DB;">' . $matches['value'] . '</span>)'; case 'resource': return '<span style="color: #0000FF;">resource</span>(<span style="color: #1287DB;">' . $matches['count'] . '</span>) of type (<span style="color: #4D5D94;">' . $matches['class'] . '</span>)'; case 'object': return '<span style="color: #0000FF;">object</span>(<span style="color: #4D5D94;">' . $matches['class'] . '</span>)#' . $matches['id'] . ' (<span style="color: #1287DB;">' . $matches['count'] . '</span>)'; } }, $output); } $header = ''; [$debugfile] = debug_backtrace(); if (!empty($debugfile['file'])) { $header = '<h4 style="border-bottom:1px solid #bbb;font-weight:bold;margin:0 0 10px 0;padding:3px 0 10px 0">' . $debugfile['file'] . '</h4>'; } echo '<pre style="background-color: #CDDCF4;border: 1px solid #bbb;border-radius: 4px;-moz-border-radius:4px;-webkit-border-radius\:4px;font-size:12px;line-height:1.4em;margin:30px;padding:7px">' . $header . $output . '</pre>'; } debug(['foo', 'bar', 'baz', 42]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HqPMc
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   61     0  E >   INIT_FCALL                                               'debug'
          1        SEND_VAL                                                 <array>
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function debug:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 22
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 22
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 36
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
Branch analysis from position: 22
filename:       /in/HqPMc
function name:  debug
number of ops:  41
compiled vars:  !0 = $variable, !1 = $output, !2 = $maps, !3 = $pattern, !4 = $function, !5 = $header, !6 = $debugfile
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'ob_start'
          2        DO_ICALL                                                 
    6     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
    7     6        INIT_FCALL                                               'ob_get_clean'
          7        DO_ICALL                                         $9      
          8        ASSIGN                                                   !1, $9
    8     9        ASSIGN                                                   !2, <array>
   17    10      > FE_RESET_R                                       $12     !2, ->22
         11    > > FE_FETCH_R                                       ~13     $12, !3, ->22
         12    >   ASSIGN                                                   !4, ~13
   18    13        INIT_FCALL                                               'preg_replace_callback'
         14        SEND_VAR                                                 !3
         15        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FHqPMc%3A18%240'
         16        BIND_LEXICAL                                             ~15, !4
   50    17        SEND_VAL                                                 ~15
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $16     
   18    20        ASSIGN                                                   !1, $16
   17    21      > JMP                                                      ->11
         22    >   FE_FREE                                                  $12
   52    23        ASSIGN                                                   !5, ''
   53    24        INIT_FCALL                                               'debug_backtrace'
         25        DO_ICALL                                         $19     
         26        FETCH_LIST_R                                     $20     $19, 0
         27        ASSIGN                                                   !6, $20
         28        FREE                                                     $19
   54    29        ISSET_ISEMPTY_DIM_OBJ                         1  ~22     !6, 'file'
         30        BOOL_NOT                                         ~23     ~22
         31      > JMPZ                                                     ~23, ->36
   55    32    >   FETCH_DIM_R                                      ~24     !6, 'file'
         33        CONCAT                                           ~25     '%3Ch4+style%3D%22border-bottom%3A1px+solid+%23bbb%3Bfont-weight%3Abold%3Bmargin%3A0+0+10px+0%3Bpadding%3A3px+0+10px+0%22%3E', ~24
         34        CONCAT                                           ~26     ~25, '%3C%2Fh4%3E'
         35        ASSIGN                                                   !5, ~26
   57    36    >   CONCAT                                           ~28     '%3Cpre+style%3D%22background-color%3A+%23CDDCF4%3Bborder%3A+1px+solid+%23bbb%3Bborder-radius%3A+4px%3B-moz-border-radius%3A4px%3B-webkit-border-radius%5C%3A4px%3Bfont-size%3A12px%3Bline-height%3A1.4em%3Bmargin%3A30px%3Bpadding%3A7px%22%3E', !5
         37        CONCAT                                           ~29     ~28, !1
         38        CONCAT                                           ~30     ~29, '%3C%2Fpre%3E'
         39        ECHO                                                     ~30
   58    40      > RETURN                                                   null

End of function debug

Function %00%7Bclosure%7D%2Fin%2FHqPMc%3A18%240:
Finding entry points
Branch analysis from position: 0
9 jumps found. (Code = 188) Position 1 = 18, Position 2 = 31, Position 3 = 62, Position 4 = 72, Position 5 = 76, Position 6 = 80, Position 7 = 87, Position 8 = 97, Position 9 = 3
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
2 jumps found. (Code = 46) Position 1 = 39, Position 2 = 42
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 47
Branch analysis from position: 43
2 jumps found. (Code = 46) Position 1 = 49, Position 2 = 52
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 57
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 57
Branch analysis from position: 52
Branch analysis from position: 47
Branch analysis from position: 42
Branch analysis from position: 62
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 72
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 76
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 80
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 87
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 97
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 18
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 31
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 62
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 72
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 76
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 80
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 87
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 97
Branch analysis from position: 97
Branch analysis from position: 87
Branch analysis from position: 80
Branch analysis from position: 76
Branch analysis from position: 72
Branch analysis from position: 62
Branch analysis from position: 31
Branch analysis from position: 18
filename:       /in/HqPMc
function name:  {closure}
number of ops:  98
compiled vars:  !0 = $matches, !1 = $function, !2 = $key, !3 = $class, !4 = $scope, !5 = $type, !6 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   19     2      > SWITCH_STRING                                            !1, [ 'string':->18, 'array':->31, 'countable':->62, 'bool':->72, 'float':->76, 'resource':->80, 'object':->87, ], ->97
   20     3    >   IS_EQUAL                                                 !1, 'string'
          4      > JMPNZ                                                    ~7, ->18
   24     5    >   IS_EQUAL                                                 !1, 'array'
          6      > JMPNZ                                                    ~7, ->31
   36     7    >   IS_EQUAL                                                 !1, 'countable'
          8      > JMPNZ                                                    ~7, ->62
   41     9    >   IS_EQUAL                                                 !1, 'bool'
         10      > JMPNZ                                                    ~7, ->72
   43    11    >   IS_EQUAL                                                 !1, 'float'
         12      > JMPNZ                                                    ~7, ->76
   45    13    >   IS_EQUAL                                                 !1, 'resource'
         14      > JMPNZ                                                    ~7, ->80
   47    15    >   IS_EQUAL                                                 !1, 'object'
         16      > JMPNZ                                                    ~7, ->87
         17    > > JMP                                                      ->97
   21    18    >   INIT_FCALL                                               'htmlspecialchars'
         19        FETCH_DIM_R                                      ~9      !0, 'value'
         20        SEND_VAL                                                 ~9
         21        DO_ICALL                                         $10     
         22        ASSIGN_DIM                                               !0, 'value'
         23        OP_DATA                                                  $10
   23    24        FETCH_DIM_R                                      ~11     !0, 'length'
         25        CONCAT                                           ~12     '%3Cspan+style%3D%22color%3A+%230000FF%3B%22%3Estring%3C%2Fspan%3E%28%3Cspan+style%3D%22color%3A+%231287DB%3B%22%3E', ~11
         26        CONCAT                                           ~13     ~12, '%29%3C%2Fspan%3E+%3Cspan+style%3D%22color%3A+%236B6E6E%3B%22%3E'
         27        FETCH_DIM_R                                      ~14     !0, 'value'
         28        CONCAT                                           ~15     ~13, ~14
         29        CONCAT                                           ~16     ~15, '%3C%2Fspan%3E'
         30      > RETURN                                                   ~16
   25    31    >   FETCH_DIM_R                                      ~17     !0, 'key'
         32        CONCAT                                           ~18     '%3Cspan+style%3D%22color%3A+%23008000%3B%22%3E%22', ~17
         33        CONCAT                                           ~19     ~18, '%22%3C%2Fspan%3E'
         34        ASSIGN                                                   !2, ~19
   26    35        ASSIGN                                                   !3, ''
   27    36        ASSIGN                                                   !4, ''
   28    37        ISSET_ISEMPTY_DIM_OBJ                         0  ~23     !0, 'class'
         38      > JMPZ_EX                                          ~23     ~23, ->42
         39    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~24     !0, 'class'
         40        BOOL_NOT                                         ~25     ~24
         41        BOOL                                             ~23     ~25
         42    > > JMPZ                                                     ~23, ->47
   29    43    >   FETCH_DIM_R                                      ~26     !0, 'class'
         44        CONCAT                                           ~27     '%3A%3Cspan+style%3D%22color%3A+%234D5D94%3B%22%3E%22', ~26
         45        CONCAT                                           ~28     ~27, '%22%3C%2Fspan%3E'
         46        ASSIGN                                                   !3, ~28
   31    47    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~30     !0, 'scope'
         48      > JMPZ_EX                                          ~30     ~30, ->52
         49    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~31     !0, 'scope'
         50        BOOL_NOT                                         ~32     ~31
         51        BOOL                                             ~30     ~32
         52    > > JMPZ                                                     ~30, ->57
   32    53    >   FETCH_DIM_R                                      ~33     !0, 'scope'
         54        CONCAT                                           ~34     '%3A%3Cspan+style%3D%22color%3A+%23666666%3B%22%3E', ~33
         55        CONCAT                                           ~35     ~34, '%3C%2Fspan%3E'
         56        ASSIGN                                                   !4, ~35
   35    57    >   CONCAT                                           ~37     '%5B', !2
         58        CONCAT                                           ~38     ~37, !3
         59        CONCAT                                           ~39     ~38, !4
         60        CONCAT                                           ~40     ~39, '%5D%3D%3E'
         61      > RETURN                                                   ~40
   37    62    >   FETCH_DIM_R                                      ~41     !0, 'type'
         63        CONCAT                                           ~42     '%3Cspan+style%3D%22color%3A+%230000FF%3B%22%3E', ~41
         64        CONCAT                                           ~43     ~42, '%3C%2Fspan%3E'
         65        ASSIGN                                                   !5, ~43
   38    66        FETCH_DIM_R                                      ~45     !0, 'count'
         67        CONCAT                                           ~46     '%28%3Cspan+style%3D%22color%3A+%231287DB%3B%22%3E', ~45
         68        CONCAT                                           ~47     ~46, '%3C%2Fspan%3E%29'
         69        ASSIGN                                                   !6, ~47
   40    70        CONCAT                                           ~49     !5, !6
         71      > RETURN                                                   ~49
   42    72    >   FETCH_DIM_R                                      ~50     !0, 'value'
         73        CONCAT                                           ~51     '%3Cspan+style%3D%22color%3A+%230000FF%3B%22%3Ebool%3C%2Fspan%3E%28%3Cspan+style%3D%22color%3A+%230000FF%3B%22%3E', ~50
         74        CONCAT                                           ~52     ~51, '%3C%2Fspan%3E%29'
         75      > RETURN                                                   ~52
   44    76    >   FETCH_DIM_R                                      ~53     !0, 'value'
         77        CONCAT                                           ~54     '%3Cspan+style%3D%22color%3A+%230000FF%3B%22%3Efloat%3C%2Fspan%3E%28%3Cspan+style%3D%22color%3A+%231287DB%3B%22%3E', ~53
         78        CONCAT                                           ~55     ~54, '%3C%2Fspan%3E%29'
         79      > RETURN                                                   ~55
   46    80    >   FETCH_DIM_R                                      ~56     !0, 'count'
         81        CONCAT                                           ~57     '%3Cspan+style%3D%22color%3A+%230000FF%3B%22%3Eresource%3C%2Fspan%3E%28%3Cspan+style%3D%22color%3A+%231287DB%3B%22%3E', ~56
         82        CONCAT                                           ~58     ~57, '%3C%2Fspan%3E%29+of+type+%28%3Cspan+style%3D%22color%3A+%234D5D94%3B%22%3E'
         83        FETCH_DIM_R                                      ~59     !0, 'class'
         84        CONCAT                                           ~60     ~58, ~59
         85        CONCAT                                           ~61     ~60, '%3C%2Fspan%3E%29'
         86      > RETURN                                                   ~61
   48    87    >   FETCH_DIM_R                                      ~62     !0, 'class'
         88        CONCAT                                           ~63     '%3Cspan+style%3D%22color%3A+%230000FF%3B%22%3Eobject%3C%2Fspan%3E%28%3Cspan+style%3D%22color%3A+%234D5D94%3B%22%3E', ~62
         89        CONCAT                                           ~64     ~63, '%3C%2Fspan%3E%29%23'
         90        FETCH_DIM_R                                      ~65     !0, 'id'
         91        CONCAT                                           ~66     ~64, ~65
         92        CONCAT                                           ~67     ~66, '+%28%3Cspan+style%3D%22color%3A+%231287DB%3B%22%3E'
         93        FETCH_DIM_R                                      ~68     !0, 'count'
         94        CONCAT                                           ~69     ~67, ~68
         95        CONCAT                                           ~70     ~69, '%3C%2Fspan%3E%29'
         96      > RETURN                                                   ~70
   50    97    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FHqPMc%3A18%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
190.42 ms | 1415 KiB | 26 Q