3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait Foo { function test() { var_dump( $this->whatever() ); } } class A { use Foo; public function whatever() { return 42; } } class B { use Foo; private function whatever() { return 'hello'; } } class C { use Foo; } (new A)->test(); (new B)->test(); (new C)->test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QIPsL
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   DECLARE_CLASS                                                'a'
   16     1        DECLARE_CLASS                                                'b'
   23     2        DECLARE_CLASS                                                'c'
   27     3        NEW                                                  $0      'A'
          4        DO_FCALL                                          0          
          5        INIT_METHOD_CALL                                             $0, 'test'
          6        DO_FCALL                                          0          
   28     7        NEW                                                  $3      'B'
          8        DO_FCALL                                          0          
          9        INIT_METHOD_CALL                                             $3, 'test'
         10        DO_FCALL                                          0          
   29    11        NEW                                                  $6      'C'
         12        DO_FCALL                                          0          
         13        INIT_METHOD_CALL                                             $6, 'test'
         14        DO_FCALL                                          0          
         15      > RETURN                                                       1

Class Foo:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QIPsL
function name:  test
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                                   'var_dump'
          1        INIT_METHOD_CALL                                             'whatever'
          2        DO_FCALL                                          0  $0      
          3        SEND_VAR                                                     $0
          4        DO_ICALL                                                     
    6     5      > RETURN                                                       null

End of function test

End of class Foo.

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

End of function whatever

End of class A.

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

End of function whatever

End of class B.

Class C: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
151.37 ms | 1404 KiB | 14 Q