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 = $foo; 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 $foo->publicProperty = 'text';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XIkND
function name:  (null)
number of ops:  12
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     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
   33     6        FETCH_OBJ_R                                      ~6      !0, 'publicProperty'
          7        ECHO                                                     ~6
   34     8        ASSIGN_OBJ                                       ~7      !0, 'publicProperty'
          9        OP_DATA                                                  'text'
         10        ECHO                                                     ~7
         11      > 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/XIkND
function name:  __construct
number of ops:  5
compiled vars:  !0 = $wrapped, !1 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        ASSIGN_OBJ                                               'wrapped'
          2        OP_DATA                                                  !1
   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/XIkND
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/XIkND
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:
149.31 ms | 1390 KiB | 13 Q