3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { private $string; private $array; public function __set($attribute, $value) { $this->$attribute = $value; } public function __get($attribute) { if (isset($attribute)) { return $this->$attribute; } } } $obg = new MyClass(); $obg->string = 'Hey it works!'; $obg->array = new ArrayObject(['This works', 'too!']); $obg->array['key'] = "This will throw 'Indirect modification of overloaded property MyClass::\$array has no effect'"; print_r($obg->array->getArrayCopy());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CSCdN
function name:  (null)
number of ops:  20
compiled vars:  !0 = $obg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'MyClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   25     3        ASSIGN_OBJ                                               !0, 'string'
          4        OP_DATA                                                  'Hey+it+works%21'
   26     5        NEW                                              $6      'ArrayObject'
          6        SEND_VAL_EX                                              <array>
          7        DO_FCALL                                      0          
          8        ASSIGN_OBJ                                               !0, 'array'
          9        OP_DATA                                                  $6
   27    10        FETCH_OBJ_W                                      $8      !0, 'array'
         11        ASSIGN_DIM                                               $8, 'key'
         12        OP_DATA                                                  'This+will+throw+%27Indirect+modification+of+overloaded+property+MyClass%3A%3A%24array+has+no+effect%27'
   29    13        INIT_FCALL                                               'print_r'
         14        FETCH_OBJ_R                                      ~10     !0, 'array'
         15        INIT_METHOD_CALL                                         ~10, 'getArrayCopy'
         16        DO_FCALL                                      0  $11     
         17        SEND_VAR                                                 $11
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Class MyClass:
Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CSCdN
function name:  __set
number of ops:  5
compiled vars:  !0 = $attribute, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        ASSIGN_OBJ                                               !0
          3        OP_DATA                                                  !1
   12     4      > RETURN                                                   null

End of function __set

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CSCdN
function name:  __get
number of ops:  6
compiled vars:  !0 = $attribute
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        ISSET_ISEMPTY_CV                                         !0
          2      > JMPZ                                                     ~1, ->5
   18     3    >   FETCH_OBJ_R                                      ~2      !0
          4      > RETURN                                                   ~2
   20     5    > > RETURN                                                   null

End of function __get

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.53 ms | 1388 KiB | 15 Q