3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Tr { function test() { static $a = 0; $a++; print $a . "\n"; } static $test2_prop = 0; function test2() { static::$test2_prop++; print static::$test2_prop . "\n"; } } class Cl { use Tr; } $c = new Cl(); $c->test(); // 1 $c->test(); // 2 $c->test(); // 3 $c->test2(); // 1 $c->test2(); // 2 $c->test2(); // 3
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PDQF8
function name:  (null)
number of ops:  17
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   DECLARE_CLASS                                            'cl'
   19     1        NEW                                              $1      'Cl'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   20     4        INIT_METHOD_CALL                                         !0, 'test'
          5        DO_FCALL                                      0          
   21     6        INIT_METHOD_CALL                                         !0, 'test'
          7        DO_FCALL                                      0          
   22     8        INIT_METHOD_CALL                                         !0, 'test'
          9        DO_FCALL                                      0          
   23    10        INIT_METHOD_CALL                                         !0, 'test2'
         11        DO_FCALL                                      0          
   24    12        INIT_METHOD_CALL                                         !0, 'test2'
         13        DO_FCALL                                      0          
   25    14        INIT_METHOD_CALL                                         !0, 'test2'
         15        DO_FCALL                                      0          
         16      > RETURN                                                   1

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

End of function test

Function test2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PDQF8
function name:  test2
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   PRE_INC_STATIC_PROP                                      'test2_prop'
   13     1        FETCH_STATIC_PROP_R          unknown             ~1      'test2_prop'
          2        CONCAT                                           ~2      ~1, '%0A'
          3        ECHO                                                     ~2
   14     4      > RETURN                                                   null

End of function test2

End of class Tr.

Class Cl: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.63 ms | 1395 KiB | 13 Q