3v4l.org

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

Class PhpClassWithPropertyDefaults: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.05 ms | 1395 KiB | 15 Q