3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static $classStatic = 1; public function test() { static $methodStatic = 1; return $methodStatic++; } } class Bar extends Foo {} $foo1 = new Foo; $foo2 = new Foo; $bar = new Bar; var_dump( $foo1->test(), $foo2->test(), $bar->test() ); Foo::$classStatic++; var_dump( Foo::$classStatic, Bar::$classStatic );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eKGWo
function name:  (null)
number of ops:  28
compiled vars:  !0 = $foo1, !1 = $foo2, !2 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $3      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   18     3        NEW                                              $6      'Foo'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $6
   19     6        NEW                                              $9      'Bar'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $9
   20     9        INIT_FCALL                                               'var_dump'
   21    10        INIT_METHOD_CALL                                         !0, 'test'
         11        DO_FCALL                                      0  $12     
         12        SEND_VAR                                                 $12
   22    13        INIT_METHOD_CALL                                         !1, 'test'
         14        DO_FCALL                                      0  $13     
         15        SEND_VAR                                                 $13
   23    16        INIT_METHOD_CALL                                         !2, 'test'
         17        DO_FCALL                                      0  $14     
         18        SEND_VAR                                                 $14
         19        DO_ICALL                                                 
   26    20        PRE_INC_STATIC_PROP                                      'classStatic', 'Foo'
   27    21        INIT_FCALL                                               'var_dump'
   28    22        FETCH_STATIC_PROP_R          unknown             ~17     'classStatic'
         23        SEND_VAL                                                 ~17
   29    24        FETCH_STATIC_PROP_R          unknown             ~18     'classStatic'
         25        SEND_VAL                                                 ~18
         26        DO_ICALL                                                 
   30    27      > RETURN                                                   1

Class Foo:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eKGWo
function name:  test
number of ops:  4
compiled vars:  !0 = $methodStatic
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   BIND_STATIC                                              !0
   11     1        POST_INC                                         ~1      !0
          2      > RETURN                                                   ~1
   12     3*     > RETURN                                                   null

End of function test

End of class Foo.

Class Bar:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eKGWo
function name:  test
number of ops:  4
compiled vars:  !0 = $methodStatic
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   BIND_STATIC                                              !0
   11     1        POST_INC                                         ~1      !0
          2      > RETURN                                                   ~1
   12     3*     > RETURN                                                   null

End of function test

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.91 ms | 1400 KiB | 15 Q