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      :77
         1        NEW                                              $2      :77
         2        DO_FCALL                                      0          
         3        SEND_VAR_NO_REF_EX                                       $2
         4        DO_FCALL                                      0          
         5        QM_ASSIGN                                                !0
  11     6        INIT_METHOD_CALL                                         !0, 'hasProperty'
         7        SEND_VAL_EX                                              'var'
         8        DO_FCALL                                      0  $6      
         9      > JMPZ                                                     $6, ->12
        10    >   ASSIGN_BW_OR                                  0  ~7      'true'
        11      > JMP                                                      ->13
        12    >   ASSIGN_BW_OR                                  0  ~7      'false'
        13    >   ASSIGN_OBJ                                               ~7
        14        ASSIGN_OBJ                                               '%0A'
  12    15        INIT_METHOD_CALL                                         !0, 'getProperty'
        16        SEND_VAL_EX                                              'var'
        17        DO_FCALL                                      0  $8      
        18        ASSIGN_OBJ                                               $8
        19        ASSIGN_OBJ                                               '%0A'
  14    20        NEW                                              $9      :51
        21        NEW                                              $10     :51
        22        DO_FCALL                                      0          
        23        SEND_VAR_NO_REF_EX                                       $10
        24        DO_FCALL                                      0          
        25        QM_ASSIGN                                                !0
  15    26        INIT_METHOD_CALL                                         !0, 'hasProperty'
        27        SEND_VAL_EX                                              'var'
        28        DO_FCALL                                      0  $14     
        29      > JMPZ                                                     $14, ->32
        30    >   ASSIGN_BW_OR                                  0  ~15     'true'
        31      > JMP                                                      ->33
        32    >   ASSIGN_BW_OR                                  0  ~15     'false'
        33    >   ASSIGN_OBJ                                               ~15
        34        ASSIGN_OBJ                                               '%0A'
  16    35        INIT_METHOD_CALL                                         !0, 'getProperty'
        36        SEND_VAL_EX                                              'var'
        37        DO_FCALL                                      0  $16     
        38        ASSIGN_OBJ                                               $16
        39        ASSIGN_OBJ                                               '%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:
36.2 ms | 467 KiB | 7 Q