3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $publicProperty = 'bar'; } class FooWrapper extends Foo { private $wrapped; public function __construct(Foo $wrapped) { $this->wrapped = $wrapped; unset($this->publicProperty); } public function __get($name) { echo 'Getting property ' . $name . PHP_EOL; return $this->wrapped->$name; } public function __set($name, $value) { echo 'Setting property ' . $name . ' to ' . $value . PHP_EOL; return $this->wrapped->$name = $value; } } $foo = new FooWrapper(new Foo()); echo $foo->publicProperty; echo PHP_EOL; echo $foo->publicProperty = 'test';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OVdiH
function name:  (null)
number of ops:  13
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   NEW                                              $1      'FooWrapper'
          1        NEW                                              $2      'Foo'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $2
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   32     6        FETCH_OBJ_R                                      ~6      !0, 'publicProperty'
          7        ECHO                                                     ~6
   33     8        ECHO                                                     '%0A'
   34     9        ASSIGN_OBJ                                       ~7      !0, 'publicProperty'
         10        OP_DATA                                                  'test'
         11        ECHO                                                     ~7
         12      > RETURN                                                   1

Class Foo: [no user functions]
Class FooWrapper:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OVdiH
function name:  __construct
number of ops:  5
compiled vars:  !0 = $wrapped
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        ASSIGN_OBJ                                               'wrapped'
          2        OP_DATA                                                  !0
   14     3        UNSET_OBJ                                                'publicProperty'
   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/OVdiH
function name:  __get
number of ops:  8
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1        CONCAT                                           ~1      'Getting+property+', !0
          2        CONCAT                                           ~2      ~1, '%0A'
          3        ECHO                                                     ~2
   20     4        FETCH_OBJ_R                                      ~3      'wrapped'
          5        FETCH_OBJ_R                                      ~4      ~3, !0
          6      > RETURN                                                   ~4
   21     7*     > RETURN                                                   null

End of function __get

Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OVdiH
function name:  __set
number of ops:  12
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   25     2        CONCAT                                           ~2      'Setting+property+', !0
          3        CONCAT                                           ~3      ~2, '+to+'
          4        CONCAT                                           ~4      ~3, !1
          5        CONCAT                                           ~5      ~4, '%0A'
          6        ECHO                                                     ~5
   26     7        FETCH_OBJ_W                                      $6      'wrapped'
          8        ASSIGN_OBJ                                       ~7      $6, !0
          9        OP_DATA                                                  !1
         10      > RETURN                                                   ~7
   27    11*     > RETURN                                                   null

End of function __set

End of class FooWrapper.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.84 ms | 1453 KiB | 13 Q