3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public static function foo() { return 'A'; } } class B extends A { public static function withSelf() { return self::foo(); } public static function withParent() { return parent::foo(); } public static function withStatic() { return static::foo(); } public static function withClass() { return (parent::class)::foo(); } } echo 'Self: '.B::withSelf(), PHP_EOL, 'Parent: '.B::withParent(), PHP_EOL, 'Static: '.B::withStatic(), PHP_EOL, 'Class: '.B::withClass();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AS32J
function name:  (null)
number of ops:  20
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_STATIC_METHOD_CALL                                  'B', 'withSelf'
          1        DO_FCALL                                      0  $0      
          2        CONCAT                                           ~1      'Self%3A+', $0
          3        ECHO                                                     ~1
          4        ECHO                                                     '%0A'
   24     5        INIT_STATIC_METHOD_CALL                                  'B', 'withParent'
          6        DO_FCALL                                      0  $2      
          7        CONCAT                                           ~3      'Parent%3A+', $2
          8        ECHO                                                     ~3
          9        ECHO                                                     '%0A'
   25    10        INIT_STATIC_METHOD_CALL                                  'B', 'withStatic'
         11        DO_FCALL                                      0  $4      
         12        CONCAT                                           ~5      'Static%3A+', $4
         13        ECHO                                                     ~5
         14        ECHO                                                     '%0A'
   26    15        INIT_STATIC_METHOD_CALL                                  'B', 'withClass'
         16        DO_FCALL                                      0  $6      
         17        CONCAT                                           ~7      'Class%3A+', $6
         18        ECHO                                                     ~7
         19      > RETURN                                                   1

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

End of function foo

End of class A.

Class B:
Function withself:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AS32J
function name:  withSelf
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_STATIC_METHOD_CALL                                  'foo'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
          3*     > RETURN                                                   null

End of function withself

Function withparent:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AS32J
function name:  withParent
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_STATIC_METHOD_CALL                                  'foo'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
          3*     > RETURN                                                   null

End of function withparent

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

End of function withstatic

Function withclass:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AS32J
function name:  withClass
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_STATIC_METHOD_CALL                                  'A', 'foo'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
          3*     > RETURN                                                   null

End of function withclass

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

End of function foo

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
207.8 ms | 1399 KiB | 13 Q