3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static $staticProperty = 'foobar'; public $property = 'barfoo'; private $privateProperty = 'foofoo'; } $reflectionClass = new ReflectionClass('Foo'); var_dump($reflectionClass->getProperty('staticProperty')->getValue()); var_dump($reflectionClass->getProperty('property')->getValue(new Foo)); $reflectionProperty = $reflectionClass->getProperty('privateProperty'); $reflectionProperty->setAccessible(true); var_dump($reflectionProperty->getValue());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ECoZr
function name:  (null)
number of ops:  36
compiled vars:  !0 = $reflectionClass, !1 = $reflectionProperty
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $2      'ReflectionClass'
          1        SEND_VAL_EX                                              'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   12     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'getProperty'
          6        SEND_VAL_EX                                              'staticProperty'
          7        DO_FCALL                                      0  $5      
          8        INIT_METHOD_CALL                                         $5, 'getValue'
          9        DO_FCALL                                      0  $6      
         10        SEND_VAR                                                 $6
         11        DO_ICALL                                                 
   13    12        INIT_FCALL                                               'var_dump'
         13        INIT_METHOD_CALL                                         !0, 'getProperty'
         14        SEND_VAL_EX                                              'property'
         15        DO_FCALL                                      0  $8      
         16        INIT_METHOD_CALL                                         $8, 'getValue'
         17        NEW                                              $9      'Foo'
         18        DO_FCALL                                      0          
         19        SEND_VAR_NO_REF_EX                                       $9
         20        DO_FCALL                                      0  $11     
         21        SEND_VAR                                                 $11
         22        DO_ICALL                                                 
   15    23        INIT_METHOD_CALL                                         !0, 'getProperty'
         24        SEND_VAL_EX                                              'privateProperty'
         25        DO_FCALL                                      0  $13     
         26        ASSIGN                                                   !1, $13
   16    27        INIT_METHOD_CALL                                         !1, 'setAccessible'
         28        SEND_VAL_EX                                              <true>
         29        DO_FCALL                                      0          
   17    30        INIT_FCALL                                               'var_dump'
         31        INIT_METHOD_CALL                                         !1, 'getValue'
         32        DO_FCALL                                      0  $16     
         33        SEND_VAR                                                 $16
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.84 ms | 1396 KiB | 15 Q