3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait Foo { public const CONSTANT = 1; public function bar(): int { return self::CONSTANT; // Fatal error } } class Bar { use Foo; } var_dump(Bar::CONSTANT); // 1 $bar = new Bar(); $bar->bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dIeOk
function name:  (null)
number of ops:  11
compiled vars:  !0 = $bar
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   DECLARE_CLASS                                                'bar'
   18     1        INIT_FCALL                                                   'var_dump'
          2        FETCH_CLASS_CONSTANT                                 ~1      'Bar', 'CONSTANT'
          3        SEND_VAL                                                     ~1
          4        DO_ICALL                                                     
   19     5        NEW                                                  $3      'Bar'
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !0, $3
   20     8        INIT_METHOD_CALL                                             !0, 'bar'
          9        DO_FCALL                                          0          
         10      > RETURN                                                       1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dIeOk
function name:  bar
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   FETCH_CLASS_CONSTANT                                 ~0      'CONSTANT'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
   10     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function bar

End of class Foo.

Class Bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.47 ms | 1502 KiB | 14 Q