3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $publicProperty; protected $protectedProperty; private $privateProperty; public function __construct() { unset( $this->publicProperty, $this->protectedProperty, $this->privateProperty ); } function __get($name) { echo 'called __get ' . $name; } function __set($name, $value) { echo 'called __set ' . $name . ' ' . $value; } } $t = new Test(); foreach (array('publicProperty', 'protectedProperty', 'privateProperty') as $propertyName) { $prop = new ReflectionProperty('Test', $propertyName); $prop->setAccessible(true); echo var_export($prop->getValue($t), true) . "\n"; $prop->setValue($t, 'value'); } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 27
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 27
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/OJCFg
function name:  (null)
number of ops:  29
compiled vars:  !0 = $t, !1 = $propertyName, !2 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $3      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   28     3      > FE_RESET_R                                       $6      <array>, ->27
          4    > > FE_FETCH_R                                               $6, !1, ->27
   29     5    >   NEW                                              $7      'ReflectionProperty'
          6        SEND_VAL_EX                                              'Test'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !2, $7
   30    10        INIT_METHOD_CALL                                         !2, 'setAccessible'
         11        SEND_VAL_EX                                              <true>
         12        DO_FCALL                                      0          
   31    13        INIT_FCALL                                               'var_export'
         14        INIT_METHOD_CALL                                         !2, 'getValue'
         15        SEND_VAR_EX                                              !0
         16        DO_FCALL                                      0  $11     
         17        SEND_VAR                                                 $11
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $12     
         20        CONCAT                                           ~13     $12, '%0A'
         21        ECHO                                                     ~13
   32    22        INIT_METHOD_CALL                                         !2, 'setValue'
         23        SEND_VAR_EX                                              !0
         24        SEND_VAL_EX                                              'value'
         25        DO_FCALL                                      0          
   28    26      > JMP                                                      ->4
         27    >   FE_FREE                                                  $6
   35    28      > RETURN                                                   1

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OJCFg
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   UNSET_OBJ                                                'publicProperty'
   12     1        UNSET_OBJ                                                'protectedProperty'
   13     2        UNSET_OBJ                                                'privateProperty'
   15     3      > 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/OJCFg
function name:  __get
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        CONCAT                                           ~1      'called+__get+', !0
          2        ECHO                                                     ~1
   19     3      > 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/OJCFg
function name:  __set
number of ops:  7
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   22     2        CONCAT                                           ~2      'called+__set+', !0
          3        CONCAT                                           ~3      ~2, '+'
          4        CONCAT                                           ~4      ~3, !1
          5        ECHO                                                     ~4
   23     6      > RETURN                                                   null

End of function __set

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.86 ms | 1400 KiB | 15 Q