3v4l.org

run code in 500+ PHP versions simultaneously
<?php function get_calling_scope() { return debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3)[2]['class'] ?? null; } class Foo { public function __get($name) { var_dump(get_calling_scope()); return ''; } public function test() { $this->bar; } } class Bar extends Foo { public function __get($name) { parent::__get($name); return ''; } } $foo = new Foo(); $foo->bar; $foo->test(); $bar = new Bar(); $bar->test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VQARq3
function name:  (null)
number of ops:  13
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   NEW                                                  $2      'Foo'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   26     3        FETCH_OBJ_R                                          ~5      !0, 'bar'
          4        FREE                                                         ~5
   27     5        INIT_METHOD_CALL                                             !0, 'test'
          6        DO_FCALL                                          0          
   29     7        NEW                                                  $7      'Bar'
          8        DO_FCALL                                          0          
          9        ASSIGN                                                       !1, $7
   30    10        INIT_METHOD_CALL                                             !1, 'test'
         11        DO_FCALL                                          0          
         12      > RETURN                                                       1

Function get_calling_scope:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VQARq3
function name:  get_calling_scope
number of ops:  10
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                                   'debug_backtrace'
          1        SEND_VAL                                                     2
          2        SEND_VAL                                                     3
          3        DO_ICALL                                             $0      
          4        FETCH_DIM_IS                                         ~1      $0, 2
          5        FETCH_DIM_IS                                         ~2      ~1, 'class'
          6        COALESCE                                             ~3      ~2
          7        QM_ASSIGN                                            ~3      null
          8      > RETURN                                                       ~3
    5     9*     > RETURN                                                       null

End of function get_calling_scope

Class Foo:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VQARq3
function name:  __get
number of ops:  8
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
    9     1        INIT_FCALL                                                   'var_dump'
          2        INIT_FCALL                                                   'get_calling_scope'
          3        DO_FCALL                                          0  $1      
          4        SEND_VAR                                                     $1
          5        DO_ICALL                                                     
   10     6      > RETURN                                                       ''
   11     7*     > RETURN                                                       null

End of function __get

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VQARq3
function name:  test
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                          ~0      'bar'
          1        FREE                                                         ~0
   15     2      > RETURN                                                       null

End of function test

End of class Foo.

Class Bar:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VQARq3
function name:  __get
number of ops:  6
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   RECV                                                 !0      
   20     1        INIT_STATIC_METHOD_CALL                                      '__get'
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0          
   21     4      > RETURN                                                       ''
   22     5*     > RETURN                                                       null

End of function __get

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VQARq3
function name:  test
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                          ~0      'bar'
          1        FREE                                                         ~0
   15     2      > RETURN                                                       null

End of function test

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
213.46 ms | 1721 KiB | 16 Q