3v4l.org

run code in 300+ PHP versions simultaneously
<?php $present=1; $min=1; $max=4; function sub() { global $present; global $max; global $min; if($present==$min) { $present=$max; } $present--; return $present; } echo sub();//it works only once echo sub(); echo sub(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3jGEl
function name:  (null)
number of ops:  13
compiled vars:  !0 = $present, !1 = $min, !2 = $max
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 1
    3     1        ASSIGN                                                   !1, 1
    4     2        ASSIGN                                                   !2, 4
   19     3        INIT_FCALL                                               'sub'
          4        DO_FCALL                                      0  $6      
          5        ECHO                                                     $6
   20     6        INIT_FCALL                                               'sub'
          7        DO_FCALL                                      0  $7      
          8        ECHO                                                     $7
   21     9        INIT_FCALL                                               'sub'
         10        DO_FCALL                                      0  $8      
         11        ECHO                                                     $8
   22    12      > RETURN                                                   1

Function sub:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/3jGEl
function name:  sub
number of ops:  9
compiled vars:  !0 = $present, !1 = $max, !2 = $min
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   BIND_GLOBAL                                              !0, 'present'
    8     1        BIND_GLOBAL                                              !1, 'max'
    9     2        BIND_GLOBAL                                              !2, 'min'
   10     3        IS_EQUAL                                                 !0, !2
          4      > JMPZ                                                     ~3, ->6
   12     5    >   ASSIGN                                                   !0, !1
   14     6    >   PRE_DEC                                                  !0
   16     7      > RETURN                                                   !0
   17     8*     > RETURN                                                   null

End of function sub

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.95 ms | 1389 KiB | 16 Q