3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test() { $var = 1; $inc = function($num) use ($var) { ++$var; return $num + $var; }; return $inc(); } $test = test(); var_dump($test); echo $test(5); echo $test(6);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tLuIh
function name:  (null)
number of ops:  15
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'test'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   15     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   16     6        INIT_DYNAMIC_CALL                                        !0
          7        SEND_VAL_EX                                              5
          8        DO_FCALL                                      0  $4      
          9        ECHO                                                     $4
   17    10        INIT_DYNAMIC_CALL                                        !0
         11        SEND_VAL_EX                                              6
         12        DO_FCALL                                      0  $5      
         13        ECHO                                                     $5
         14      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tLuIh
function name:  test
number of ops:  8
compiled vars:  !0 = $var, !1 = $inc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 1
    6     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FtLuIh%3A6%240'
          2        BIND_LEXICAL                                             ~3, !0
          3        ASSIGN                                                   !1, ~3
   11     4        INIT_DYNAMIC_CALL                                        !1
          5        DO_FCALL                                      0  $5      
          6      > RETURN                                                   $5
   12     7*     > RETURN                                                   null

End of function test

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

End of function %00%7Bclosure%7D%2Fin%2FtLuIh%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.27 ms | 1390 KiB | 16 Q