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); var_dump($foo->bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UtugD
function name:  (null)
number of ops:  11
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'FooInterceptor'
          1        NEW                                              $2      'Foo'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $2
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   25     6        INIT_FCALL                                               'var_dump'
          7        FETCH_OBJ_R                                      ~6      !0, 'bar'
          8        SEND_VAL                                                 ~6
          9        DO_ICALL                                                 
         10      > 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/UtugD
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/UtugD
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:
136.85 ms | 999 KiB | 14 Q