3v4l.org

run code in 300+ PHP versions simultaneously
<?php class t { const A = 1; function __construct() { $r = new ReflectionClass($this); var_dump($r->hasConstant('A')); var_dump($r->hasConstant('c')); var_dump($r->hasConstant('A'), self::A); } protected function getA() { return self::A; } protected function getB() { return self::B; } } class s extends t { const A = 2; const B = 3; function __construct() { $r = new ReflectionClass($this); var_dump($r->hasConstant('A'), self::A, $this->getA()); } } $t = new t; $s = new s;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o4hYW
function name:  (null)
number of ops:  7
compiled vars:  !0 = $t, !1 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $2      't'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   29     3        NEW                                              $5      's'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
          6      > RETURN                                                   1

Class t:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o4hYW
function name:  __construct
number of ops:  25
compiled vars:  !0 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $1      'ReflectionClass'
          1        FETCH_THIS                                       $2      
          2        SEND_VAR_EX                                              $2
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
    7     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'hasConstant'
          7        SEND_VAL_EX                                              'A'
          8        DO_FCALL                                      0  $5      
          9        SEND_VAR                                                 $5
         10        DO_ICALL                                                 
    8    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !0, 'hasConstant'
         13        SEND_VAL_EX                                              'c'
         14        DO_FCALL                                      0  $7      
         15        SEND_VAR                                                 $7
         16        DO_ICALL                                                 
    9    17        INIT_FCALL                                               'var_dump'
         18        INIT_METHOD_CALL                                         !0, 'hasConstant'
         19        SEND_VAL_EX                                              'A'
         20        DO_FCALL                                      0  $9      
         21        SEND_VAR                                                 $9
         22        SEND_VAL                                                 1
         23        DO_ICALL                                                 
   10    24      > RETURN                                                   null

End of function __construct

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

End of function geta

Function getb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o4hYW
function name:  getB
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_CLASS_CONSTANT                             ~0      'B'
          1      > RETURN                                                   ~0
   18     2*     > RETURN                                                   null

End of function getb

End of class t.

Class s:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o4hYW
function name:  __construct
number of ops:  16
compiled vars:  !0 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $1      'ReflectionClass'
          1        FETCH_THIS                                       $2      
          2        SEND_VAR_EX                                              $2
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   25     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'hasConstant'
          7        SEND_VAL_EX                                              'A'
          8        DO_FCALL                                      0  $5      
          9        SEND_VAR                                                 $5
         10        SEND_VAL                                                 2
         11        INIT_METHOD_CALL                                         'getA'
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                                 
   26    15      > RETURN                                                   null

End of function __construct

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

End of function geta

Function getb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/o4hYW
function name:  getB
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_CLASS_CONSTANT                             ~0      'B'
          1      > RETURN                                                   ~0
   18     2*     > RETURN                                                   null

End of function getb

End of class s.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.4 ms | 1400 KiB | 15 Q