3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dbg_bt($level = 0) { $currentLevel = 0; $level = (int)$level; $trace = debug_backtrace(); echo "\nBACKTRACE\n=========\n"; foreach ($trace as $data ) { $parsed = parse_dbg($data); echo sprintf("%03d %s\n", $currentLevel, $parsed); $currentLevel++; if ( 0 !== $level && $currentLevel >= $level) { break; } } echo "=========\n\n"; } function parse_dbg (array $data) { if (!empty($data['type'])) { return sprintf( "[%s:%d] %s%s%s(%s)", $data['file'], $data['line'], $data['class'], $data['type'], $data['function'], get_args($data['args']) ); } else { return sprintf( "[%s:%d] %s(%s)", $data['file'], $data['line'], $data['function'], get_args($data['args']) ); } } function get_args(array $params) { $result = array(); foreach ($params as $val) { if('object' == gettype($val)) { $result[] = get_class($val); } else { $result[] = gettype($val); } } return implode(", ", $result); } class lol { static public function rofl($args = null) { ob_start(); dbg_bt(); $x = ob_get_contents(); ob_end_clean(); echo $x; // replace with trigger error } } echo "<pre>"; lol::rofl(new StdClass()); echo "Website content<br />".__FILE__."<br /><br /><br />";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WbLOv
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   63     0  E >   ECHO                                                     '%3Cpre%3E'
   64     1        INIT_STATIC_METHOD_CALL                                  'lol', 'rofl'
          2        NEW                                              $0      'StdClass'
          3        DO_FCALL                                      0          
          4        SEND_VAR                                                 $0
          5        DO_FCALL                                      0          
   65     6        ECHO                                                     'Website+content%3Cbr+%2F%3E%2Fin%2FWbLOv%3Cbr+%2F%3E%3Cbr+%2F%3E%3Cbr+%2F%3E'
          7      > RETURN                                                   1

Function dbg_bt:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 28
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 28
Branch analysis from position: 10
2 jumps found. (Code = 46) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 27
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 25
Branch analysis from position: 28
Branch analysis from position: 28
filename:       /in/WbLOv
function name:  dbg_bt
number of ops:  31
compiled vars:  !0 = $level, !1 = $currentLevel, !2 = $trace, !3 = $data, !4 = $parsed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      0
    5     1        ASSIGN                                                   !1, 0
    6     2        CAST                                          4  ~6      !0
          3        ASSIGN                                                   !0, ~6
    7     4        INIT_FCALL                                               'debug_backtrace'
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !2, $8
    9     7        ECHO                                                     '%0ABACKTRACE%0A%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A'
   10     8      > FE_RESET_R                                       $10     !2, ->28
          9    > > FE_FETCH_R                                               $10, !3, ->28
   11    10    >   INIT_FCALL_BY_NAME                                       'parse_dbg'
         11        SEND_VAR_EX                                              !3
         12        DO_FCALL                                      0  $11     
         13        ASSIGN                                                   !4, $11
   12    14        INIT_FCALL                                               'sprintf'
         15        SEND_VAL                                                 '%2503d+%25s%0A'
         16        SEND_VAR                                                 !1
         17        SEND_VAR                                                 !4
         18        DO_ICALL                                         $13     
         19        ECHO                                                     $13
   13    20        PRE_INC                                                  !1
   14    21        IS_NOT_IDENTICAL                                 ~15     !0, 0
         22      > JMPZ_EX                                          ~15     ~15, ->25
         23    >   IS_SMALLER_OR_EQUAL                              ~16     !0, !1
         24        BOOL                                             ~15     ~16
         25    > > JMPZ                                                     ~15, ->27
   15    26    > > JMP                                                      ->28
   10    27    > > JMP                                                      ->9
         28    >   FE_FREE                                                  $10
   18    29        ECHO                                                     '%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A%0A'
   19    30      > RETURN                                                   null

End of function dbg_bt

Function parse_dbg:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 25
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WbLOv
function name:  parse_dbg
number of ops:  42
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   22     1        ISSET_ISEMPTY_DIM_OBJ                         1  ~1      !0, 'type'
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->25
   23     4    >   INIT_FCALL                                               'sprintf'
   24     5        SEND_VAL                                                 '%5B%25s%3A%25d%5D+%25s%25s%25s%28%25s%29'
   25     6        FETCH_DIM_R                                      ~3      !0, 'file'
          7        SEND_VAL                                                 ~3
   26     8        FETCH_DIM_R                                      ~4      !0, 'line'
          9        SEND_VAL                                                 ~4
   27    10        FETCH_DIM_R                                      ~5      !0, 'class'
         11        SEND_VAL                                                 ~5
   28    12        FETCH_DIM_R                                      ~6      !0, 'type'
         13        SEND_VAL                                                 ~6
   29    14        FETCH_DIM_R                                      ~7      !0, 'function'
         15        SEND_VAL                                                 ~7
   30    16        INIT_FCALL_BY_NAME                                       'get_args'
         17        CHECK_FUNC_ARG                                           
         18        FETCH_DIM_FUNC_ARG                               $8      !0, 'args'
         19        SEND_FUNC_ARG                                            $8
         20        DO_FCALL                                      0  $9      
         21        SEND_VAR                                                 $9
         22        DO_ICALL                                         $10     
         23      > RETURN                                                   $10
         24*       JMP                                                      ->41
   34    25    >   INIT_FCALL                                               'sprintf'
   35    26        SEND_VAL                                                 '%5B%25s%3A%25d%5D+%25s%28%25s%29'
   36    27        FETCH_DIM_R                                      ~11     !0, 'file'
         28        SEND_VAL                                                 ~11
   37    29        FETCH_DIM_R                                      ~12     !0, 'line'
         30        SEND_VAL                                                 ~12
   38    31        FETCH_DIM_R                                      ~13     !0, 'function'
         32        SEND_VAL                                                 ~13
   39    33        INIT_FCALL_BY_NAME                                       'get_args'
         34        CHECK_FUNC_ARG                                           
         35        FETCH_DIM_FUNC_ARG                               $14     !0, 'args'
         36        SEND_FUNC_ARG                                            $14
         37        DO_FCALL                                      0  $15     
         38        SEND_VAR                                                 $15
         39        DO_ICALL                                         $16     
         40      > RETURN                                                   $16
   42    41*     > RETURN                                                   null

End of function parse_dbg

Function get_args:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/WbLOv
function name:  get_args
number of ops:  22
compiled vars:  !0 = $params, !1 = $result, !2 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   RECV                                             !0      
   45     1        ASSIGN                                                   !1, <array>
   46     2      > FE_RESET_R                                       $4      !0, ->15
          3    > > FE_FETCH_R                                               $4, !2, ->15
   47     4    >   GET_TYPE                                         ~5      !2
          5        IS_EQUAL                                                 ~5, 'object'
          6      > JMPZ                                                     ~6, ->11
          7    >   GET_CLASS                                        ~8      !2
          8        ASSIGN_DIM                                               !1
          9        OP_DATA                                                  ~8
         10      > JMP                                                      ->14
   48    11    >   GET_TYPE                                         ~10     !2
         12        ASSIGN_DIM                                               !1
         13        OP_DATA                                                  ~10
   46    14    > > JMP                                                      ->3
         15    >   FE_FREE                                                  $4
   50    16        INIT_FCALL                                               'implode'
         17        SEND_VAL                                                 '%2C+'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $11     
         20      > RETURN                                                   $11
   51    21*     > RETURN                                                   null

End of function get_args

Class lol:
Function rofl:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WbLOv
function name:  rofl
number of ops:  12
compiled vars:  !0 = $args, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   54     0  E >   RECV_INIT                                        !0      null
   55     1        INIT_FCALL                                               'ob_start'
          2        DO_ICALL                                                 
   56     3        INIT_FCALL                                               'dbg_bt'
          4        DO_FCALL                                      0          
   57     5        INIT_FCALL                                               'ob_get_contents'
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
   58     8        INIT_FCALL                                               'ob_end_clean'
          9        DO_ICALL                                                 
   59    10        ECHO                                                     !1
   60    11      > RETURN                                                   null

End of function rofl

End of class lol.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.81 ms | 1415 KiB | 26 Q