3v4l.org

run code in 300+ PHP versions simultaneously
<?php function closure() { $a = 0; return function ($a) { return $a++; }; } $c = closure(); var_dump($c()); var_dump($c()); var_dump($c()); var_dump($c()); var_dump($c());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t4qVe
function name:  (null)
number of ops:  29
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'closure'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   11     3        INIT_FCALL                                               'var_dump'
          4        INIT_DYNAMIC_CALL                                        !0
          5        DO_FCALL                                      0  $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
   12     8        INIT_FCALL                                               'var_dump'
          9        INIT_DYNAMIC_CALL                                        !0
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                                 
   13    13        INIT_FCALL                                               'var_dump'
         14        INIT_DYNAMIC_CALL                                        !0
         15        DO_FCALL                                      0  $7      
         16        SEND_VAR                                                 $7
         17        DO_ICALL                                                 
   14    18        INIT_FCALL                                               'var_dump'
         19        INIT_DYNAMIC_CALL                                        !0
         20        DO_FCALL                                      0  $9      
         21        SEND_VAR                                                 $9
         22        DO_ICALL                                                 
   15    23        INIT_FCALL                                               'var_dump'
         24        INIT_DYNAMIC_CALL                                        !0
         25        DO_FCALL                                      0  $11     
         26        SEND_VAR                                                 $11
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

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

End of function closure

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

End of function %00%7Bclosure%7D%2Fin%2Ft4qVe%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.21 ms | 1403 KiB | 16 Q