3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Acme { public function __construct( public readonly int $changeMe, ) {} } $object = new Acme(1); $reflection = new ReflectionClass($object); $instance = $reflection->newInstanceWithoutConstructor(); $reflectionProperty = $reflection->getProperty('changeMe'); $reflectionProperty->setValue($instance, 33); var_dump($reflectionProperty->getValue($instance));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mis1l
function name:  (null)
number of ops:  26
compiled vars:  !0 = $object, !1 = $reflection, !2 = $instance, !3 = $reflectionProperty
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $4      'Acme'
          1        SEND_VAL_EX                                              1
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
   10     4        NEW                                              $7      'ReflectionClass'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $7
   11     8        INIT_METHOD_CALL                                         !1, 'newInstanceWithoutConstructor'
          9        DO_FCALL                                      0  $10     
         10        ASSIGN                                                   !2, $10
   12    11        INIT_METHOD_CALL                                         !1, 'getProperty'
         12        SEND_VAL_EX                                              'changeMe'
         13        DO_FCALL                                      0  $12     
         14        ASSIGN                                                   !3, $12
   13    15        INIT_METHOD_CALL                                         !3, 'setValue'
         16        SEND_VAR_EX                                              !2
         17        SEND_VAL_EX                                              33
         18        DO_FCALL                                      0          
   15    19        INIT_FCALL                                               'var_dump'
         20        INIT_METHOD_CALL                                         !3, 'getValue'
         21        SEND_VAR_EX                                              !2
         22        DO_FCALL                                      0  $15     
         23        SEND_VAR                                                 $15
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Class Acme:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mis1l
function name:  __construct
number of ops:  4
compiled vars:  !0 = $changeMe
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'changeMe'
          2        OP_DATA                                                  !0
    6     3      > RETURN                                                   null

End of function __construct

End of class Acme.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.21 ms | 1452 KiB | 14 Q