3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait MyTrait { public function __get($name) { echo get_class($this); } } class Foo { use MyTrait; public function __get($name) { echo 'X' . get_class($this); } } $foo = new Foo(); echo $foo->unknown;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GIlS5
function name:  (null)
number of ops:  7
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                            'foo'
   20     1        NEW                                              $1      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   21     4        FETCH_OBJ_R                                      ~4      !0, 'unknown'
          5        ECHO                                                     ~4
          6      > RETURN                                                   1

Class MyTrait:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GIlS5
function name:  __get
number of ops:  5
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        FETCH_THIS                                       ~1      
          2        GET_CLASS                                        ~2      ~1
          3        ECHO                                                     ~2
    8     4      > RETURN                                                   null

End of function __get

End of class MyTrait.

Class Foo:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GIlS5
function name:  __get
number of ops:  6
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        FETCH_THIS                                       ~1      
          2        GET_CLASS                                        ~2      ~1
          3        CONCAT                                           ~3      'X', ~2
          4        ECHO                                                     ~3
   17     5      > RETURN                                                   null

End of function __get

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.49 ms | 1394 KiB | 13 Q