3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $bar = 'baz'; } class FooInterceptor extends Foo { private $wrapped; public function __construct(Foo $wrapped) { $this->wrapped = $wrapped; unset($this->bar); } public function __get(string $name) { var_dump('reading ' . $name); return $this->wrapped->$name; } } $foo = new FooInterceptor(new Foo); $reflectionFooBar = new \ReflectionProperty(Foo::class, 'bar'); var_dump($reflectionFooBar->getValue($foo));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6JtWT
function name:  (null)
number of ops:  18
compiled vars:  !0 = $foo, !1 = $reflectionFooBar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $2      'FooInterceptor'
          1        NEW                                              $3      'Foo'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $3
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   25     6        NEW                                              $7      'ReflectionProperty'
          7        SEND_VAL_EX                                              'Foo'
          8        SEND_VAL_EX                                              'bar'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $7
   27    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !1, 'getValue'
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0  $10     
         15        SEND_VAR                                                 $10
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Class Foo: [no user functions]
Class FooInterceptor:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6JtWT
function name:  __construct
number of ops:  5
compiled vars:  !0 = $wrapped
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        ASSIGN_OBJ                                               'wrapped'
          2        OP_DATA                                                  !0
   14     3        UNSET_OBJ                                                'bar'
   15     4      > RETURN                                                   null

End of function __construct

Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6JtWT
function name:  __get
number of ops:  9
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   18     1        INIT_FCALL                                               'var_dump'
          2        CONCAT                                           ~1      'reading+', !0
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                                 
   19     5        FETCH_OBJ_R                                      ~3      'wrapped'
          6        FETCH_OBJ_R                                      ~4      ~3, !0
          7      > RETURN                                                   ~4
   20     8*     > RETURN                                                   null

End of function __get

End of class FooInterceptor.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.56 ms | 999 KiB | 14 Q