3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Test1 { public static function testStaticMethod() { static $num = 0; $num++; echo __METHOD__ . $num . PHP_EOL; } } Test1::testStaticMethod(); if (true) { class Test2 extends Test1 { } } Test2::testStaticMethod(); Test2::testStaticMethod(); if (true) { class Test3 extends Test1 { } } Test3::testStaticMethod(); Test3::testStaticMethod();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
Branch analysis from position: 4
filename:       /in/C79UV
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   INIT_STATIC_METHOD_CALL                                      'Test1', 'testStaticMethod'
          1        DO_FCALL                                          0          
   14     2      > JMPZ                                                         <true>, ->4
   15     3    >   DECLARE_CLASS                                                'test2', 'test1'
   19     4    >   INIT_STATIC_METHOD_CALL                                      'Test2', 'testStaticMethod'
          5        DO_FCALL                                          0          
   20     6        INIT_STATIC_METHOD_CALL                                      'Test2', 'testStaticMethod'
          7        DO_FCALL                                          0          
   22     8      > JMPZ                                                         <true>, ->10
   23     9    >   DECLARE_CLASS                                                'test3', 'test1'
   27    10    >   INIT_STATIC_METHOD_CALL                                      'Test3', 'testStaticMethod'
         11        DO_FCALL                                          0          
   28    12        INIT_STATIC_METHOD_CALL                                      'Test3', 'testStaticMethod'
         13        DO_FCALL                                          0          
         14      > RETURN                                                       1

Class Test1:
Function teststaticmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C79UV
function name:  testStaticMethod
number of ops:  6
compiled vars:  !0 = $num
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                                  !0
    7     1        PRE_INC                                                      !0
    8     2        CONCAT                                               ~2      'Test1%3A%3AtestStaticMethod', !0
          3        CONCAT                                               ~3      ~2, '%0A'
          4        ECHO                                                         ~3
    9     5      > RETURN                                                       null

End of function teststaticmethod

End of class Test1.

Class Test2: [no user functions]
Class Test3: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
132.62 ms | 1510 KiB | 8 Q