3v4l.org

run code in 300+ PHP versions simultaneously
<?php $func = function () { static $val; if (!isset($val)) { $val = 0; } return ++$val; }; var_dump($func()); $func2 = clone $func; var_dump($func()); var_dump($func2());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B5AZ3
function name:  (null)
number of ops:  20
compiled vars:  !0 = $func, !1 = $func2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FB5AZ3%3A2%240'
          1        ASSIGN                                                   !0, ~2
   11     2        INIT_FCALL                                               'var_dump'
          3        INIT_DYNAMIC_CALL                                        !0
          4        DO_FCALL                                      0  $4      
          5        SEND_VAR                                                 $4
          6        DO_ICALL                                                 
   13     7        CLONE                                            ~6      !0
          8        ASSIGN                                                   !1, ~6
   15     9        INIT_FCALL                                               'var_dump'
         10        INIT_DYNAMIC_CALL                                        !0
         11        DO_FCALL                                      0  $8      
         12        SEND_VAR                                                 $8
         13        DO_ICALL                                                 
   16    14        INIT_FCALL                                               'var_dump'
         15        INIT_DYNAMIC_CALL                                        !1
         16        DO_FCALL                                      0  $10     
         17        SEND_VAR                                                 $10
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FB5AZ3%3A2%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/B5AZ3
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   BIND_STATIC                                              !0
    4     1        ISSET_ISEMPTY_CV                                 ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->5
    6     4    >   ASSIGN                                                   !0, 0
    8     5    >   PRE_INC                                          ~4      !0
          6      > RETURN                                                   ~4
    9     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FB5AZ3%3A2%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
199.01 ms | 1396 KiB | 15 Q