3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class AbstractClass { public function __construct() { } public function get($property) { $rc = new \ReflectionClass($this); $p = $rc->getProperty($property); $p->setAccessible(true); return $p->getValue($this); } public function set($property, $value) { $rc = new \ReflectionClass($this); $p = $rc->getProperty($property); $p->setAccessible(true); $p->setValue($this, $value); return $this; } } abstract class MetadataClass extends AbstractClass { private $metadataA; private $metadataB; } class ActualClass extends MetadataClass { private $realField1; private $realField2; } $impl = new ActualClass(); $impl->set('realField1', 'Hello World'); echo $impl->get('realField1');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cjcrd
function name:  (null)
number of ops:  12
compiled vars:  !0 = $impl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   NEW                                              $1      'ActualClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   33     3        INIT_METHOD_CALL                                         !0, 'set'
          4        SEND_VAL_EX                                              'realField1'
          5        SEND_VAL_EX                                              'Hello+World'
          6        DO_FCALL                                      0          
   34     7        INIT_METHOD_CALL                                         !0, 'get'
          8        SEND_VAL_EX                                              'realField1'
          9        DO_FCALL                                      0  $5      
         10        ECHO                                                     $5
         11      > RETURN                                                   1

Class AbstractClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cjcrd
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E > > RETURN                                                   null

End of function __construct

Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cjcrd
function name:  get
number of ops:  19
compiled vars:  !0 = $property, !1 = $rc, !2 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        NEW                                              $3      'ReflectionClass'
          2        FETCH_THIS                                       $4      
          3        SEND_VAR_EX                                              $4
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $3
    8     6        INIT_METHOD_CALL                                         !1, 'getProperty'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $7      
          9        ASSIGN                                                   !2, $7
    9    10        INIT_METHOD_CALL                                         !2, 'setAccessible'
         11        SEND_VAL_EX                                              <true>
         12        DO_FCALL                                      0          
   10    13        INIT_METHOD_CALL                                         !2, 'getValue'
         14        FETCH_THIS                                       $10     
         15        SEND_VAR_EX                                              $10
         16        DO_FCALL                                      0  $11     
         17      > RETURN                                                   $11
   11    18*     > RETURN                                                   null

End of function get

Function set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cjcrd
function name:  set
number of ops:  22
compiled vars:  !0 = $property, !1 = $value, !2 = $rc, !3 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        NEW                                              $4      'ReflectionClass'
          3        FETCH_THIS                                       $5      
          4        SEND_VAR_EX                                              $5
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !2, $4
   15     7        INIT_METHOD_CALL                                         !2, 'getProperty'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0  $8      
         10        ASSIGN                                                   !3, $8
   16    11        INIT_METHOD_CALL                                         !3, 'setAccessible'
         12        SEND_VAL_EX                                              <true>
         13        DO_FCALL                                      0          
   17    14        INIT_METHOD_CALL                                         !3, 'setValue'
         15        FETCH_THIS                                       $11     
         16        SEND_VAR_EX                                              $11
         17        SEND_VAR_EX                                              !1
         18        DO_FCALL                                      0          
   18    19        FETCH_THIS                                       ~13     
         20      > RETURN                                                   ~13
   19    21*     > RETURN                                                   null

End of function set

End of class AbstractClass.

Class MetadataClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cjcrd
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E > > RETURN                                                   null

End of function __construct

Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cjcrd
function name:  get
number of ops:  19
compiled vars:  !0 = $property, !1 = $rc, !2 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        NEW                                              $3      'ReflectionClass'
          2        FETCH_THIS                                       $4      
          3        SEND_VAR_EX                                              $4
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $3
    8     6        INIT_METHOD_CALL                                         !1, 'getProperty'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $7      
          9        ASSIGN                                                   !2, $7
    9    10        INIT_METHOD_CALL                                         !2, 'setAccessible'
         11        SEND_VAL_EX                                              <true>
         12        DO_FCALL                                      0          
   10    13        INIT_METHOD_CALL                                         !2, 'getValue'
         14        FETCH_THIS                                       $10     
         15        SEND_VAR_EX                                              $10
         16        DO_FCALL                                      0  $11     
         17      > RETURN                                                   $11
   11    18*     > RETURN                                                   null

End of function get

Function set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cjcrd
function name:  set
number of ops:  22
compiled vars:  !0 = $property, !1 = $value, !2 = $rc, !3 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        NEW                                              $4      'ReflectionClass'
          3        FETCH_THIS                                       $5      
          4        SEND_VAR_EX                                              $5
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !2, $4
   15     7        INIT_METHOD_CALL                                         !2, 'getProperty'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0  $8      
         10        ASSIGN                                                   !3, $8
   16    11        INIT_METHOD_CALL                                         !3, 'setAccessible'
         12        SEND_VAL_EX                                              <true>
         13        DO_FCALL                                      0          
   17    14        INIT_METHOD_CALL                                         !3, 'setValue'
         15        FETCH_THIS                                       $11     
         16        SEND_VAR_EX                                              $11
         17        SEND_VAR_EX                                              !1
         18        DO_FCALL                                      0          
   18    19        FETCH_THIS                                       ~13     
         20      > RETURN                                                   ~13
   19    21*     > RETURN                                                   null

End of function set

End of class MetadataClass.

Class ActualClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cjcrd
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E > > RETURN                                                   null

End of function __construct

Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cjcrd
function name:  get
number of ops:  19
compiled vars:  !0 = $property, !1 = $rc, !2 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        NEW                                              $3      'ReflectionClass'
          2        FETCH_THIS                                       $4      
          3        SEND_VAR_EX                                              $4
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $3
    8     6        INIT_METHOD_CALL                                         !1, 'getProperty'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $7      
          9        ASSIGN                                                   !2, $7
    9    10        INIT_METHOD_CALL                                         !2, 'setAccessible'
         11        SEND_VAL_EX                                              <true>
         12        DO_FCALL                                      0          
   10    13        INIT_METHOD_CALL                                         !2, 'getValue'
         14        FETCH_THIS                                       $10     
         15        SEND_VAR_EX                                              $10
         16        DO_FCALL                                      0  $11     
         17      > RETURN                                                   $11
   11    18*     > RETURN                                                   null

End of function get

Function set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cjcrd
function name:  set
number of ops:  22
compiled vars:  !0 = $property, !1 = $value, !2 = $rc, !3 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        NEW                                              $4      'ReflectionClass'
          3        FETCH_THIS                                       $5      
          4        SEND_VAR_EX                                              $5
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !2, $4
   15     7        INIT_METHOD_CALL                                         !2, 'getProperty'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0  $8      
         10        ASSIGN                                                   !3, $8
   16    11        INIT_METHOD_CALL                                         !3, 'setAccessible'
         12        SEND_VAL_EX                                              <true>
         13        DO_FCALL                                      0          
   17    14        INIT_METHOD_CALL                                         !3, 'setValue'
         15        FETCH_THIS                                       $11     
         16        SEND_VAR_EX                                              $11
         17        SEND_VAR_EX                                              !1
         18        DO_FCALL                                      0          
   18    19        FETCH_THIS                                       ~13     
         20      > RETURN                                                   ~13
   19    21*     > RETURN                                                   null

End of function set

End of class ActualClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.36 ms | 1461 KiB | 13 Q