3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DTO { public function __construct( public array $prop = [] ) {} } $default = (new ReflectionProperty(DTO::class, 'prop'))->getDefaultValue(); var_dump($default); // Здесь NULL
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r9iv4
function name:  (null)
number of ops:  11
compiled vars:  !0 = $default
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $1      'ReflectionProperty'
          1        SEND_VAL_EX                                              'DTO'
          2        SEND_VAL_EX                                              'prop'
          3        DO_FCALL                                      0          
          4        INIT_METHOD_CALL                                         $1, 'getDefaultValue'
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !0, $3
   12     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

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

End of function __construct

End of class DTO.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
13.2 ms | 411 KiB | 7 Q