3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test1 { public static function testStaticMethod() { static $num = 0; $num++; echo __METHOD__ . $num . PHP_EOL; } } 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 = 1, Position 2 = 2
Branch analysis from position: 1
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
Branch analysis from position: 2
filename:       /in/trNoO
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > JMPZ                                                     <true>, ->2
   13     1    >   DECLARE_CLASS                                            'test2', 'test1'
   17     2    >   INIT_STATIC_METHOD_CALL                                  'Test2', 'testStaticMethod'
          3        DO_FCALL                                      0          
   18     4        INIT_STATIC_METHOD_CALL                                  'Test2', 'testStaticMethod'
          5        DO_FCALL                                      0          
   20     6      > JMPZ                                                     <true>, ->8
   21     7    >   DECLARE_CLASS                                            'test3', 'test1'
   25     8    >   INIT_STATIC_METHOD_CALL                                  'Test3', 'testStaticMethod'
          9        DO_FCALL                                      0          
   26    10        INIT_STATIC_METHOD_CALL                                  'Test3', 'testStaticMethod'
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Class Test1:
Function teststaticmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/trNoO
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.0.0


preferences:
144.83 ms | 995 KiB | 13 Q