3v4l.org

run code in 300+ PHP versions simultaneously
<?php function counter() { static $c = 0; $c++; echo $c."\n"; return $c; } $cnt1 = counter(); $cnt1++; // this does not influence counter $cnt2 =& counter(); $cnt2++; // this does influence counter counter();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QNXfq
function name:  (null)
number of ops:  11
compiled vars:  !0 = $cnt1, !1 = $cnt2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'counter'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   11     3        PRE_INC                                                  !0
   12     4        INIT_FCALL                                               'counter'
          5        DO_FCALL                                      0  $5      
          6        ASSIGN_REF                                               !1, $5
   13     7        PRE_INC                                                  !1
   14     8        INIT_FCALL                                               'counter'
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

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

End of function counter

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.13 ms | 1397 KiB | 16 Q