3v4l.org

run code in 500+ PHP versions simultaneously
<?php // Without patch (HEAD) class A { public static function hello() { return 'hello'; } public static function say() { return static::hello() . ' world'; } } class ASub extends A { public static function say() { return parent::say() . '!'; } } // With patch trait TestTrait { public static function hello() { return 'hello'; } } class B { use TestTrait; public static function say() { return static::hello() . ' world'; } } class BSub extends B { public static function say() { return parent::say() . '!'; } } var_dump(A::say()); var_dump(ASub::say()); var_dump(B::say()); var_dump(BSub::say());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gLqn
function name:  (null)
number of ops:  23
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   DECLARE_CLASS                                                'b'
   31     1        DECLARE_CLASS                                                'bsub', 'b'
   37     2        INIT_FCALL                                                   'var_dump'
          3        INIT_STATIC_METHOD_CALL                                      'A', 'say'
          4        DO_FCALL                                          0  $0      
          5        SEND_VAR                                                     $0
          6        DO_ICALL                                                     
   38     7        INIT_FCALL                                                   'var_dump'
          8        INIT_STATIC_METHOD_CALL                                      'ASub', 'say'
          9        DO_FCALL                                          0  $2      
         10        SEND_VAR                                                     $2
         11        DO_ICALL                                                     
   40    12        INIT_FCALL                                                   'var_dump'
         13        INIT_STATIC_METHOD_CALL                                      'B', 'say'
         14        DO_FCALL                                          0  $4      
         15        SEND_VAR                                                     $4
         16        DO_ICALL                                                     
   41    17        INIT_FCALL                                                   'var_dump'
         18        INIT_STATIC_METHOD_CALL                                      'BSub', 'say'
         19        DO_FCALL                                          0  $6      
         20        SEND_VAR                                                     $6
         21        DO_ICALL                                                     
         22      > RETURN                                                       1

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

End of function hello

Function say:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gLqn
function name:  say
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   INIT_STATIC_METHOD_CALL                                      'hello'
          1        DO_FCALL                                          0  $0      
          2        CONCAT                                               ~1      $0, '+world'
          3      > RETURN                                                       ~1
   11     4*     > RETURN                                                       null

End of function say

End of class A.

Class ASub:
Function say:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gLqn
function name:  say
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   INIT_STATIC_METHOD_CALL                                      'say'
          1        DO_FCALL                                          0  $0      
          2        CONCAT                                               ~1      $0, '%21'
          3      > RETURN                                                       ~1
   16     4*     > RETURN                                                       null

End of function say

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

End of function hello

End of class ASub.

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

End of function hello

End of class TestTrait.

Class B:
Function say:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gLqn
function name:  say
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E >   INIT_STATIC_METHOD_CALL                                      'hello'
          1        DO_FCALL                                          0  $0      
          2        CONCAT                                               ~1      $0, '+world'
          3      > RETURN                                                       ~1
   29     4*     > RETURN                                                       null

End of function say

End of class B.

Class BSub:
Function say:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6gLqn
function name:  say
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   33     0  E >   INIT_STATIC_METHOD_CALL                                      'say'
          1        DO_FCALL                                          0  $0      
          2        CONCAT                                               ~1      $0, '%21'
          3      > RETURN                                                       ~1
   34     4*     > RETURN                                                       null

End of function say

End of class BSub.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.54 ms | 1526 KiB | 9 Q