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 ($data) { if (!is_array($data)) { return ""; } 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($params) { if (!is_array($params)) { return ""; } $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/T72us
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   69     0  E >   ECHO                                                     '%3Cpre%3E'
   70     1        INIT_STATIC_METHOD_CALL                                  'lol', 'rofl'
          2        NEW                                              $0      'StdClass'
          3        DO_FCALL                                      0          
          4        SEND_VAR                                                 $0
          5        DO_FCALL                                      0          
   71     6        ECHO                                                     'Website+content%3Cbr+%2F%3E%2Fin%2FT72us%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/T72us
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 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 29
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T72us
function name:  parse_dbg
number of ops:  46
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   22     1        TYPE_CHECK                                  128  ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->5
   23     4    > > RETURN                                                   ''
   25     5    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~3      !0, 'type'
          6        BOOL_NOT                                         ~4      ~3
          7      > JMPZ                                                     ~4, ->29
   26     8    >   INIT_FCALL                                               'sprintf'
   27     9        SEND_VAL                                                 '%5B%25s%3A%25d%5D+%25s%25s%25s%28%25s%29'
   28    10        FETCH_DIM_R                                      ~5      !0, 'file'
         11        SEND_VAL                                                 ~5
   29    12        FETCH_DIM_R                                      ~6      !0, 'line'
         13        SEND_VAL                                                 ~6
   30    14        FETCH_DIM_R                                      ~7      !0, 'class'
         15        SEND_VAL                                                 ~7
   31    16        FETCH_DIM_R                                      ~8      !0, 'type'
         17        SEND_VAL                                                 ~8
   32    18        FETCH_DIM_R                                      ~9      !0, 'function'
         19        SEND_VAL                                                 ~9
   33    20        INIT_FCALL_BY_NAME                                       'get_args'
         21        CHECK_FUNC_ARG                                           
         22        FETCH_DIM_FUNC_ARG                               $10     !0, 'args'
         23        SEND_FUNC_ARG                                            $10
         24        DO_FCALL                                      0  $11     
         25        SEND_VAR                                                 $11
         26        DO_ICALL                                         $12     
         27      > RETURN                                                   $12
         28*       JMP                                                      ->45
   37    29    >   INIT_FCALL                                               'sprintf'
   38    30        SEND_VAL                                                 '%5B%25s%3A%25d%5D+%25s%28%25s%29'
   39    31        FETCH_DIM_R                                      ~13     !0, 'file'
         32        SEND_VAL                                                 ~13
   40    33        FETCH_DIM_R                                      ~14     !0, 'line'
         34        SEND_VAL                                                 ~14
   41    35        FETCH_DIM_R                                      ~15     !0, 'function'
         36        SEND_VAL                                                 ~15
   42    37        INIT_FCALL_BY_NAME                                       'get_args'
         38        CHECK_FUNC_ARG                                           
         39        FETCH_DIM_FUNC_ARG                               $16     !0, 'args'
         40        SEND_FUNC_ARG                                            $16
         41        DO_FCALL                                      0  $17     
         42        SEND_VAR                                                 $17
         43        DO_ICALL                                         $18     
         44      > RETURN                                                   $18
   45    45*     > RETURN                                                   null

End of function parse_dbg

Function get_args:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/T72us
function name:  get_args
number of ops:  26
compiled vars:  !0 = $params, !1 = $result, !2 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   RECV                                             !0      
   48     1        TYPE_CHECK                                  128  ~3      !0
          2        BOOL_NOT                                         ~4      ~3
          3      > JMPZ                                                     ~4, ->5
   49     4    > > RETURN                                                   ''
   51     5    >   ASSIGN                                                   !1, <array>
   52     6      > FE_RESET_R                                       $6      !0, ->19
          7    > > FE_FETCH_R                                               $6, !2, ->19
   53     8    >   GET_TYPE                                         ~7      !2
          9        IS_EQUAL                                                 ~7, 'object'
         10      > JMPZ                                                     ~8, ->15
         11    >   GET_CLASS                                        ~10     !2
         12        ASSIGN_DIM                                               !1
         13        OP_DATA                                                  ~10
         14      > JMP                                                      ->18
   54    15    >   GET_TYPE                                         ~12     !2
         16        ASSIGN_DIM                                               !1
         17        OP_DATA                                                  ~12
   52    18    > > JMP                                                      ->7
         19    >   FE_FREE                                                  $6
   56    20        INIT_FCALL                                               'implode'
         21        SEND_VAL                                                 '%2C+'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                         $13     
         24      > RETURN                                                   $13
   57    25*     > 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/T72us
function name:  rofl
number of ops:  12
compiled vars:  !0 = $args, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   60     0  E >   RECV_INIT                                        !0      null
   61     1        INIT_FCALL                                               'ob_start'
          2        DO_ICALL                                                 
   62     3        INIT_FCALL                                               'dbg_bt'
          4        DO_FCALL                                      0          
   63     5        INIT_FCALL                                               'ob_get_contents'
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
   64     8        INIT_FCALL                                               'ob_end_clean'
          9        DO_ICALL                                                 
   65    10        ECHO                                                     !1
   66    11      > RETURN                                                   null

End of function rofl

End of class lol.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.74 ms | 1411 KiB | 26 Q