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')); } } class s extends t { function __construct() { $r = new ReflectionClass($this); var_dump($r->hasConstant('A'), self::A); } } $t = new t; $s = new s;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rL1PL
function name:  (null)
number of ops:  7
compiled vars:  !0 = $t, !1 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $2      't'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   17     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/rL1PL
function name:  __construct
number of ops:  12
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      > RETURN                                                   null

End of function __construct

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/rL1PL
function name:  __construct
number of ops:  14
compiled vars:  !0 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $1      'ReflectionClass'
          1        FETCH_THIS                                       $2      
          2        SEND_VAR_EX                                              $2
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   13     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        FETCH_CLASS_CONSTANT                             ~6      'A'
         11        SEND_VAL                                                 ~6
         12        DO_ICALL                                                 
   14    13      > RETURN                                                   null

End of function __construct

End of class s.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.25 ms | 1388 KiB | 15 Q