3v4l.org

run code in 500+ 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($name) { var_dump('reading ' . $name); return $this->wrapped->$name; } } $foo = new FooInterceptor(new Foo); var_dump($foo->bar); $class = new ReflectionClass(FooInterceptor::class); $property = $class->getProperty('bar'); var_dump($property);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NAg1l
function name:  (null)
number of ops:  22
compiled vars:  !0 = $foo, !1 = $class, !2 = $property
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   NEW                                                  $3      'FooInterceptor'
          1        NEW                                                  $4      'Foo'
          2        DO_FCALL                                          0          
          3        SEND_VAR_NO_REF_EX                                           $4
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !0, $3
   25     6        INIT_FCALL                                                   'var_dump'
          7        FETCH_OBJ_R                                          ~8      !0, 'bar'
          8        SEND_VAL                                                     ~8
          9        DO_ICALL                                                     
   27    10        NEW                                                  $10     'ReflectionClass'
         11        SEND_VAL_EX                                                  'FooInterceptor'
         12        DO_FCALL                                          0          
         13        ASSIGN                                                       !1, $10
   28    14        INIT_METHOD_CALL                                             !1, 'getProperty'
         15        SEND_VAL_EX                                                  'bar'
         16        DO_FCALL                                          0  $13     
         17        ASSIGN                                                       !2, $13
   30    18        INIT_FCALL                                                   'var_dump'
         19        SEND_VAR                                                     !2
         20        DO_ICALL                                                     
         21      > 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/NAg1l
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/NAg1l
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.5.0


preferences:
233.38 ms | 2173 KiB | 14 Q