3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $fn = (function() { $i = 0; return function() use(&$i) { return $i++; }; })(); var_dump($fn()); var_dump($fn()); var_dump($fn());
based on MV8Nv
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/INBqA
function name:  (null)
number of ops:  20
compiled vars:  !0 = $fn
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FINBqA0x7fd39f13d064'
   8     1        INIT_DYNAMIC_CALL                                        ~1
         2        DO_FCALL                                      0  $2      
         3        ASSIGN                                                   !0, $2
   9     4        INIT_FCALL                                               'var_dump'
         5        INIT_DYNAMIC_CALL                                        !0
         6        DO_FCALL                                      0  $4      
         7        SEND_VAR                                                 $4
         8        DO_ICALL                                                 
  10     9        INIT_FCALL                                               'var_dump'
        10        INIT_DYNAMIC_CALL                                        !0
        11        DO_FCALL                                      0  $6      
        12        SEND_VAR                                                 $6
        13        DO_ICALL                                                 
  11    14        INIT_FCALL                                               'var_dump'
        15        INIT_DYNAMIC_CALL                                        !0
        16        DO_FCALL                                      0  $8      
        17        SEND_VAR                                                 $8
        18        DO_ICALL                                                 
        19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FINBqA0x7fd39f13d064:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/INBqA
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $i
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   4     0  E >   ASSIGN                                                   !0, 0
   5     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FINBqA0x7fd39f13d061'
         2        BIND_LEXICAL                                             ~2, !0
   7     3      > RETURN                                                   ~2
   8     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FINBqA0x7fd39f13d064

Function %00%7Bclosure%7D%2Fin%2FINBqA0x7fd39f13d061:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/INBqA
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $i
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   5     0  E >   BIND_STATIC                                              !0, 'i'
   6     1        POST_INC                                         ~1      !0
         2      > RETURN                                                   ~1
   7     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FINBqA0x7fd39f13d061

Generated using Vulcan Logic Dumper, using php 7.3.0