3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A {} $a = new A; $a->foo = "dynamic property"; $ro = new ReflectionObject($a); $prop = $ro->getProperty('foo'); try { var_dump($prop->getValue($a)); var_dump($prop->getValue(new A)); } catch (ReflectionException $ex) { echo "Caught!\n"; try { var_dump($prop->getValue(new A)); } catch (ReflectionException $ex) { var_dump($ex->getMessage()); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 28
Branch analysis from position: 28
2 jumps found. (Code = 107) Position 1 = 29, Position 2 = -2
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Found catch point at position: 39
Branch analysis from position: 39
2 jumps found. (Code = 107) Position 1 = 40, Position 2 = -2
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PHAvK
function name:  (null)
number of ops:  46
compiled vars:  !0 = $a, !1 = $ro, !2 = $prop, !3 = $ex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   NEW                                              $4      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    5     3        ASSIGN_OBJ                                               !0, 'foo'
          4        OP_DATA                                                  'dynamic+property'
    6     5        NEW                                              $8      'ReflectionObject'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $8
    7     9        INIT_METHOD_CALL                                         !1, 'getProperty'
         10        SEND_VAL_EX                                              'foo'
         11        DO_FCALL                                      0  $11     
         12        ASSIGN                                                   !2, $11
    9    13        INIT_FCALL                                               'var_dump'
         14        INIT_METHOD_CALL                                         !2, 'getValue'
         15        SEND_VAR_EX                                              !0
         16        DO_FCALL                                      0  $13     
         17        SEND_VAR                                                 $13
         18        DO_ICALL                                                 
   10    19        INIT_FCALL                                               'var_dump'
         20        INIT_METHOD_CALL                                         !2, 'getValue'
         21        NEW                                              $15     'A'
         22        DO_FCALL                                      0          
         23        SEND_VAR_NO_REF_EX                                       $15
         24        DO_FCALL                                      0  $17     
         25        SEND_VAR                                                 $17
         26        DO_ICALL                                                 
         27      > JMP                                                      ->45
   11    28  E > > CATCH                                       last         'ReflectionException'
   12    29    >   ECHO                                                     'Caught%21%0A'
   14    30        INIT_FCALL                                               'var_dump'
         31        INIT_METHOD_CALL                                         !2, 'getValue'
         32        NEW                                              $19     'A'
         33        DO_FCALL                                      0          
         34        SEND_VAR_NO_REF_EX                                       $19
         35        DO_FCALL                                      0  $21     
         36        SEND_VAR                                                 $21
         37        DO_ICALL                                                 
         38      > JMP                                                      ->45
   15    39  E > > CATCH                                       last         'ReflectionException'
   16    40    >   INIT_FCALL                                               'var_dump'
         41        INIT_METHOD_CALL                                         !3, 'getMessage'
         42        DO_FCALL                                      0  $23     
         43        SEND_VAR                                                 $23
         44        DO_ICALL                                                 
   18    45    > > RETURN                                                   1

Class A: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.45 ms | 1405 KiB | 15 Q