3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Base { private $shadow; } #[AllowDynamicProperties] class Child extends Base {} $o = new Child(); $o->shadow = true; $o->noShadow = true; var_dump($o); echo "\n"; $r = new ReflectionObject($o); echo "hasProperty():\n"; var_dump($r->hasProperty('shadow')); var_dump($r->hasProperty('noShadow')); echo "\n"; echo "getProperty():\n"; try { var_dump($r->getProperty('shadow')); } catch (ReflectionException $e) { echo $e->getMessage(). "\n"; } echo "\n"; var_dump($r->getProperty('noShadow')); echo "\n"; echo "getProperties():\n"; var_dump($r->getProperties());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 37
Branch analysis from position: 37
2 jumps found. (Code = 107) Position 1 = 38, Position 2 = -2
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gf30Fg
function name:  (null)
number of ops:  57
compiled vars:  !0 = $o, !1 = $r, !2 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   NEW                                                  $3      'Child'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $3
   11     3        ASSIGN_OBJ                                                   !0, 'shadow'
          4        OP_DATA                                                      <true>
   12     5        ASSIGN_OBJ                                                   !0, 'noShadow'
          6        OP_DATA                                                      <true>
   13     7        INIT_FCALL                                                   'var_dump'
          8        SEND_VAR                                                     !0
          9        DO_ICALL                                                     
   14    10        ECHO                                                         '%0A'
   16    11        NEW                                                  $9      'ReflectionObject'
         12        SEND_VAR_EX                                                  !0
         13        DO_FCALL                                          0          
         14        ASSIGN                                                       !1, $9
   18    15        ECHO                                                         'hasProperty%28%29%3A%0A'
   19    16        INIT_FCALL                                                   'var_dump'
         17        INIT_METHOD_CALL                                             !1, 'hasProperty'
         18        SEND_VAL_EX                                                  'shadow'
         19        DO_FCALL                                          0  $12     
         20        SEND_VAR                                                     $12
         21        DO_ICALL                                                     
   20    22        INIT_FCALL                                                   'var_dump'
         23        INIT_METHOD_CALL                                             !1, 'hasProperty'
         24        SEND_VAL_EX                                                  'noShadow'
         25        DO_FCALL                                          0  $14     
         26        SEND_VAR                                                     $14
         27        DO_ICALL                                                     
   21    28        ECHO                                                         '%0A'
   23    29        ECHO                                                         'getProperty%28%29%3A%0A'
   25    30        INIT_FCALL                                                   'var_dump'
         31        INIT_METHOD_CALL                                             !1, 'getProperty'
         32        SEND_VAL_EX                                                  'shadow'
         33        DO_FCALL                                          0  $16     
         34        SEND_VAR                                                     $16
         35        DO_ICALL                                                     
         36      > JMP                                                          ->42
   26    37  E > > CATCH                                           last         'ReflectionException'
   27    38    >   INIT_METHOD_CALL                                             !2, 'getMessage'
         39        DO_FCALL                                          0  $18     
         40        CONCAT                                               ~19     $18, '%0A'
         41        ECHO                                                         ~19
   29    42    >   ECHO                                                         '%0A'
   30    43        INIT_FCALL                                                   'var_dump'
         44        INIT_METHOD_CALL                                             !1, 'getProperty'
         45        SEND_VAL_EX                                                  'noShadow'
         46        DO_FCALL                                          0  $20     
         47        SEND_VAR                                                     $20
         48        DO_ICALL                                                     
   32    49        ECHO                                                         '%0A'
   33    50        ECHO                                                         'getProperties%28%29%3A%0A'
   34    51        INIT_FCALL                                                   'var_dump'
         52        INIT_METHOD_CALL                                             !1, 'getProperties'
         53        DO_FCALL                                          0  $22     
         54        SEND_VAR                                                     $22
         55        DO_ICALL                                                     
         56      > RETURN                                                       1

Class Base: [no user functions]
Class Child: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
180.17 ms | 3684 KiB | 14 Q