3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_cc() { $calls = debug_backtrace(); if (!isset($calls[1])) { return NULL; } $call = $calls[1]; var_dump($call); if (isset($call['object'])) { return get_class($call['object']); } } class Bar { public function bar() { echo get_cc(), "\n<br>"; } public static function baz() { echo get_cc(), "\n<br>"; } } class Foo extends Bar { } $foo = new Foo; $foo->bar(); Foo::baz(); echo get_cc(), "\n<br>";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ntn6m
function name:  (null)
number of ops:  12
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   41     3        INIT_METHOD_CALL                                         !0, 'bar'
          4        DO_FCALL                                      0          
   43     5        INIT_STATIC_METHOD_CALL                                  'Foo', 'baz'
          6        DO_FCALL                                      0          
   45     7        INIT_FCALL                                               'get_cc'
          8        DO_FCALL                                      0  $6      
          9        ECHO                                                     $6
         10        ECHO                                                     '%0A%3Cbr%3E'
         11      > RETURN                                                   1

Function get_cc:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ntn6m
function name:  get_cc
number of ops:  18
compiled vars:  !0 = $calls, !1 = $call
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'debug_backtrace'
          1        DO_ICALL                                         $2      
          2        ASSIGN                                                   !0, $2
    6     3        ISSET_ISEMPTY_DIM_OBJ                         0  ~4      !0, 1
          4        BOOL_NOT                                         ~5      ~4
          5      > JMPZ                                                     ~5, ->7
    7     6    > > RETURN                                                   null
    9     7    >   FETCH_DIM_R                                      ~6      !0, 1
          8        ASSIGN                                                   !1, ~6
   10     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   11    12        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'object'
         13      > JMPZ                                                     ~9, ->17
   12    14    >   FETCH_DIM_R                                      ~10     !1, 'object'
         15        GET_CLASS                                        ~11     ~10
         16      > RETURN                                                   ~11
   15    17    > > RETURN                                                   null

End of function get_cc

Class Bar:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ntn6m
function name:  bar
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'get_cc'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3        ECHO                                                     '%0A%3Cbr%3E'
   25     4      > RETURN                                                   null

End of function bar

Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ntn6m
function name:  baz
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_FCALL                                               'get_cc'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3        ECHO                                                     '%0A%3Cbr%3E'
   30     4      > RETURN                                                   null

End of function baz

End of class Bar.

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ntn6m
function name:  bar
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'get_cc'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3        ECHO                                                     '%0A%3Cbr%3E'
   25     4      > RETURN                                                   null

End of function bar

Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ntn6m
function name:  baz
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_FCALL                                               'get_cc'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3        ECHO                                                     '%0A%3Cbr%3E'
   30     4      > RETURN                                                   null

End of function baz

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.38 ms | 948 KiB | 23 Q