3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static function staticfunction() { static::anotherstaticfunction(); } public function nonstaticfunction() { $this->anotherstaticfunction(); static::anotherstaticfunction(); } public static function anotherstaticfunction() { } } //Foo::staticfunction(); // works (new Foo())->nonstaticfunction(); // works
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0P6jr
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $0      'Foo'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'nonstaticfunction'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

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

End of function staticfunction

Function nonstaticfunction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0P6jr
function name:  nonstaticfunction
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_METHOD_CALL                                         'anotherstaticfunction'
          1        DO_FCALL                                      0          
   12     2        INIT_STATIC_METHOD_CALL                                  'anotherstaticfunction'
          3        DO_FCALL                                      0          
   13     4      > RETURN                                                   null

End of function nonstaticfunction

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

End of function anotherstaticfunction

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.03 ms | 1394 KiB | 13 Q