3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $var; } class B extends A { } $ro = new ReflectionObject(new A()); echo $ro->hasProperty('var') ? 'true' : 'false', "\n"; // returns true echo $ro->getProperty('var'), "\n"; // prints property $ro = new ReflectionObject(new B()); echo $ro->hasProperty('var') ? 'true' : 'false', "\n"; // returns true echo $ro->getProperty('var'), "\n"; // throws exception
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
Branch analysis from position: 32
filename:       /in/PRA1f
function name:  (null)
number of ops:  41
compiled vars:  !0 = $ro
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $1      'ReflectionObject'
          1        NEW                                              $2      'A'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $2
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   11     6        INIT_METHOD_CALL                                         !0, 'hasProperty'
          7        SEND_VAL_EX                                              'var'
          8        DO_FCALL                                      0  $6      
          9      > JMPZ                                                     $6, ->12
         10    >   QM_ASSIGN                                        ~7      'true'
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~7      'false'
         13    >   ECHO                                                     ~7
         14        ECHO                                                     '%0A'
   12    15        INIT_METHOD_CALL                                         !0, 'getProperty'
         16        SEND_VAL_EX                                              'var'
         17        DO_FCALL                                      0  $8      
         18        ECHO                                                     $8
         19        ECHO                                                     '%0A'
   14    20        NEW                                              $9      'ReflectionObject'
         21        NEW                                              $10     'B'
         22        DO_FCALL                                      0          
         23        SEND_VAR_NO_REF_EX                                       $10
         24        DO_FCALL                                      0          
         25        ASSIGN                                                   !0, $9
   15    26        INIT_METHOD_CALL                                         !0, 'hasProperty'
         27        SEND_VAL_EX                                              'var'
         28        DO_FCALL                                      0  $14     
         29      > JMPZ                                                     $14, ->32
         30    >   QM_ASSIGN                                        ~15     'true'
         31      > JMP                                                      ->33
         32    >   QM_ASSIGN                                        ~15     'false'
         33    >   ECHO                                                     ~15
         34        ECHO                                                     '%0A'
   16    35        INIT_METHOD_CALL                                         !0, 'getProperty'
         36        SEND_VAL_EX                                              'var'
         37        DO_FCALL                                      0  $16     
         38        ECHO                                                     $16
         39        ECHO                                                     '%0A'
         40      > RETURN                                                   1

Class A: [no user functions]
Class B: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.15 ms | 1399 KiB | 13 Q