3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __construct() { $bar = new Bar(); $bar->test(); } } class Bar { public function test() { $this->test2(); } public function test2() { list(, $caller) = debug_backtrace(false); echo $caller['class']; } } $foo = new Foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6mdPN
function name:  (null)
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
          3      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6mdPN
function name:  __construct
number of ops:  6
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $1      'Bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
    8     3        INIT_METHOD_CALL                                         !0, 'test'
          4        DO_FCALL                                      0          
    9     5      > RETURN                                                   null

End of function __construct

End of class Foo.

Class Bar:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6mdPN
function name:  test
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_METHOD_CALL                                         'test2'
          1        DO_FCALL                                      0          
   17     2      > RETURN                                                   null

End of function test

Function test2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6mdPN
function name:  test2
number of ops:  9
compiled vars:  !0 = $caller
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'debug_backtrace'
          1        SEND_VAL                                                 <false>
          2        DO_ICALL                                         $1      
          3        FETCH_LIST_R                                     $2      $1, 1
          4        ASSIGN                                                   !0, $2
          5        FREE                                                     $1
   22     6        FETCH_DIM_R                                      ~4      !0, 'class'
          7        ECHO                                                     ~4
   23     8      > RETURN                                                   null

End of function test2

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.52 ms | 1388 KiB | 15 Q