3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait TestTrait { private function baz() { return 'Hello World'; } } class Foo { use TestTrait; public function __construct() { echo $this->baz(); } } abstract class A { const __default = null; public function __construct() { $class = get_class($this); var_dump(__CLASS__); $r = new ReflectionClass($class); $constants = $r->getConstants(); var_dump($constants); } } class B extends A { const __default = self::A; const A = 'a'; const B = 'b'; } class C extends B { const __default = self::C; const A = 'A'; const C = 'c'; } //$enum = new C(); $foo = new Foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TR7jQ
function name:  (null)
number of ops:  5
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                            'foo'
   51     1        NEW                                              $1      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
          4      > RETURN                                                   1

Class TestTrait:
Function baz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TR7jQ
function name:  baz
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E > > RETURN                                                   'Hello+World'
    8     1*     > RETURN                                                   null

End of function baz

End of class TestTrait.

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TR7jQ
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_METHOD_CALL                                         'baz'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
   18     3      > RETURN                                                   null

End of function __construct

End of class Foo.

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TR7jQ
function name:  __construct
number of ops:  17
compiled vars:  !0 = $class, !1 = $r, !2 = $constants
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   FETCH_THIS                                       ~3      
          1        GET_CLASS                                        ~4      ~3
          2        ASSIGN                                                   !0, ~4
   28     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAL                                                 'A'
          5        DO_ICALL                                                 
   30     6        NEW                                              $7      'ReflectionClass'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $7
   31    10        INIT_METHOD_CALL                                         !1, 'getConstants'
         11        DO_FCALL                                      0  $10     
         12        ASSIGN                                                   !2, $10
   32    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
   33    16      > RETURN                                                   null

End of function __construct

End of class A.

Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TR7jQ
function name:  __construct
number of ops:  17
compiled vars:  !0 = $class, !1 = $r, !2 = $constants
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   FETCH_THIS                                       ~3      
          1        GET_CLASS                                        ~4      ~3
          2        ASSIGN                                                   !0, ~4
   28     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAL                                                 'A'
          5        DO_ICALL                                                 
   30     6        NEW                                              $7      'ReflectionClass'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $7
   31    10        INIT_METHOD_CALL                                         !1, 'getConstants'
         11        DO_FCALL                                      0  $10     
         12        ASSIGN                                                   !2, $10
   32    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
   33    16      > RETURN                                                   null

End of function __construct

End of class B.

Class C:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TR7jQ
function name:  __construct
number of ops:  17
compiled vars:  !0 = $class, !1 = $r, !2 = $constants
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   FETCH_THIS                                       ~3      
          1        GET_CLASS                                        ~4      ~3
          2        ASSIGN                                                   !0, ~4
   28     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAL                                                 'A'
          5        DO_ICALL                                                 
   30     6        NEW                                              $7      'ReflectionClass'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $7
   31    10        INIT_METHOD_CALL                                         !1, 'getConstants'
         11        DO_FCALL                                      0  $10     
         12        ASSIGN                                                   !2, $10
   32    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
   33    16      > RETURN                                                   null

End of function __construct

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.72 ms | 1400 KiB | 15 Q