3v4l.org

run code in 300+ PHP versions simultaneously
<?php for ($i=0; $i<5; $i++) { $func = function () { static $val; if (!isset($val)) { $val = 0; } return ++$val; }; var_dump($func()); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 2
Branch analysis from position: 12
Branch analysis from position: 2
filename:       /in/oa03U
function name:  (null)
number of ops:  13
compiled vars:  !0 = $i, !1 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->10
    4     2    >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Foa03U%3A4%240'
          3        ASSIGN                                                   !1, ~3
   12     4        INIT_FCALL                                               'var_dump'
          5        INIT_DYNAMIC_CALL                                        !1
          6        DO_FCALL                                      0  $5      
          7        SEND_VAR                                                 $5
          8        DO_ICALL                                                 
    2     9        PRE_INC                                                  !0
         10    >   IS_SMALLER                                               !0, 5
         11      > JMPNZ                                                    ~8, ->2
   13    12    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Foa03U%3A4%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/oa03U
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   BIND_STATIC                                              !0
    6     1        ISSET_ISEMPTY_CV                                 ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->5
    8     4    >   ASSIGN                                                   !0, 0
   10     5    >   PRE_INC                                          ~4      !0
          6      > RETURN                                                   ~4
   11     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Foa03U%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.01 ms | 1395 KiB | 15 Q