3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { private $privateProperty; public function setPrivateProperty($prop) { $this->privateProperty = $prop; return $this; } public function evaluate(MyClass1 $object) { // this works, because visibility is checked on class name, not on concrete instance! var_dump($object->privateProperty); } } class MyClass1 { private $privateProperty; public function setPrivateProperty($prop) { $this->privateProperty = $prop; return $this; } } $obj1 = (new MyClass)->setPrivateProperty('foo'); $obj2 = (new MyClass1)->setPrivateProperty('bar'); $obj1->evaluate($obj2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9I0XB
function name:  (null)
number of ops:  16
compiled vars:  !0 = $obj1, !1 = $obj2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   NEW                                              $2      'MyClass'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $2, 'setPrivateProperty'
          3        SEND_VAL_EX                                              'foo'
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !0, $4
   32     6        NEW                                              $6      'MyClass1'
          7        DO_FCALL                                      0          
          8        INIT_METHOD_CALL                                         $6, 'setPrivateProperty'
          9        SEND_VAL_EX                                              'bar'
         10        DO_FCALL                                      0  $8      
         11        ASSIGN                                                   !1, $8
   34    12        INIT_METHOD_CALL                                         !0, 'evaluate'
         13        SEND_VAR_EX                                              !1
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

Class MyClass:
Function setprivateproperty:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9I0XB
function name:  setPrivateProperty
number of ops:  6
compiled vars:  !0 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ                                               'privateProperty'
          2        OP_DATA                                                  !0
    9     3        FETCH_THIS                                       ~2      
          4      > RETURN                                                   ~2
   10     5*     > RETURN                                                   null

End of function setprivateproperty

Function evaluate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9I0XB
function name:  evaluate
number of ops:  6
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   15     1        INIT_FCALL                                               'var_dump'
          2        FETCH_OBJ_R                                      ~1      !0, 'privateProperty'
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                                 
   16     5      > RETURN                                                   null

End of function evaluate

End of class MyClass.

Class MyClass1:
Function setprivateproperty:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9I0XB
function name:  setPrivateProperty
number of ops:  6
compiled vars:  !0 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   25     1        ASSIGN_OBJ                                               'privateProperty'
          2        OP_DATA                                                  !0
   26     3        FETCH_THIS                                       ~2      
          4      > RETURN                                                   ~2
   27     5*     > RETURN                                                   null

End of function setprivateproperty

End of class MyClass1.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.8 ms | 1400 KiB | 15 Q