3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base { public function __get($property) { $reflector = new ReflectionObject($this); if ($reflector->hasProperty($property)) { return $reflector->getProperty($property)->getValue(); } } } class Child extends Base { private $test = 'This is a test.'; } class Test extends Child { } $test = new Test; var_dump($test->test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tg5Cf
function name:  (null)
number of ops:  8
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        INIT_FCALL                                               'var_dump'
          4        FETCH_OBJ_R                                      ~4      !0, 'test'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Class Base:
Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tg5Cf
function name:  __get
number of ops:  17
compiled vars:  !0 = $property, !1 = $reflector
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        NEW                                              $2      'ReflectionObject'
          2        FETCH_THIS                                       $3      
          3        SEND_VAR_EX                                              $3
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $2
    5     6        INIT_METHOD_CALL                                         !1, 'hasProperty'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $6      
          9      > JMPZ                                                     $6, ->16
    6    10    >   INIT_METHOD_CALL                                         !1, 'getProperty'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0  $7      
         13        INIT_METHOD_CALL                                         $7, 'getValue'
         14        DO_FCALL                                      0  $8      
         15      > RETURN                                                   $8
    8    16    > > RETURN                                                   null

End of function __get

End of class Base.

Class Child:
Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tg5Cf
function name:  __get
number of ops:  17
compiled vars:  !0 = $property, !1 = $reflector
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        NEW                                              $2      'ReflectionObject'
          2        FETCH_THIS                                       $3      
          3        SEND_VAR_EX                                              $3
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $2
    5     6        INIT_METHOD_CALL                                         !1, 'hasProperty'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $6      
          9      > JMPZ                                                     $6, ->16
    6    10    >   INIT_METHOD_CALL                                         !1, 'getProperty'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0  $7      
         13        INIT_METHOD_CALL                                         $7, 'getValue'
         14        DO_FCALL                                      0  $8      
         15      > RETURN                                                   $8
    8    16    > > RETURN                                                   null

End of function __get

End of class Child.

Class Test:
Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tg5Cf
function name:  __get
number of ops:  17
compiled vars:  !0 = $property, !1 = $reflector
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        NEW                                              $2      'ReflectionObject'
          2        FETCH_THIS                                       $3      
          3        SEND_VAR_EX                                              $3
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $2
    5     6        INIT_METHOD_CALL                                         !1, 'hasProperty'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $6      
          9      > JMPZ                                                     $6, ->16
    6    10    >   INIT_METHOD_CALL                                         !1, 'getProperty'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0  $7      
         13        INIT_METHOD_CALL                                         $7, 'getValue'
         14        DO_FCALL                                      0  $8      
         15      > RETURN                                                   $8
    8    16    > > RETURN                                                   null

End of function __get

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.63 ms | 1400 KiB | 15 Q