3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_cc() { foreach (debug_backtrace() as $call) { if (!isset($call['class'])) { continue; } return $call['class']; } } class Foo { public function bar() { echo get_cc(), "\n"; } public static function baz() { echo get_cc(), "\n"; } } $foo = new Foo; $foo->bar(); Foo::baz();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3G49h
function name:  (null)
number of ops:  8
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   33     3        INIT_METHOD_CALL                                         !0, 'bar'
          4        DO_FCALL                                      0          
   35     5        INIT_STATIC_METHOD_CALL                                  'Foo', 'baz'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Function get_cc:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/3G49h
function name:  get_cc
number of ops:  14
compiled vars:  !0 = $call
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'debug_backtrace'
          1        DO_ICALL                                         $1      
          2      > FE_RESET_R                                       $2      $1, ->12
          3    > > FE_FETCH_R                                               $2, !0, ->12
    6     4    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~3      !0, 'class'
          5        BOOL_NOT                                         ~4      ~3
          6      > JMPZ                                                     ~4, ->8
    7     7    > > JMP                                                      ->3
    9     8    >   FETCH_DIM_R                                      ~5      !0, 'class'
          9        FE_FREE                                                  $2
         10      > RETURN                                                   ~5
    5    11*       JMP                                                      ->3
         12    >   FE_FREE                                                  $2
   12    13      > RETURN                                                   null

End of function get_cc

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3G49h
function name:  bar
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'get_cc'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3        ECHO                                                     '%0A'
   22     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/3G49h
function name:  baz
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_FCALL                                               'get_cc'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3        ECHO                                                     '%0A'
   27     4      > RETURN                                                   null

End of function baz

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.83 ms | 1394 KiB | 17 Q