3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fn = (function() { $i = 0; return function() use(&$i) { return $i++; }; })(); var_dump($fn()); var_dump($fn()); var_dump($fn());
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%2FINBqA%3A3%240'
    8     1        INIT_DYNAMIC_CALL                                        ~1
          2        DO_FCALL                                      0  $2      
    3     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%2FINBqA%3A3%240:
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%2FINBqA%3A5%241'
          2        BIND_LEXICAL                                             ~2, !0
    7     3      > RETURN                                                   ~2
    8     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FINBqA%3A3%240

Function %00%7Bclosure%7D%2Fin%2FINBqA%3A5%241:
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
    6     1        POST_INC                                         ~1      !0
          2      > RETURN                                                   ~1
    7     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FINBqA%3A5%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.69 ms | 1396 KiB | 15 Q