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(); echo $test(5); echo $test(6);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V9L0R
function name:  (null)
number of ops:  12
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
   16     3        INIT_DYNAMIC_CALL                                        !0
          4        SEND_VAL_EX                                              5
          5        DO_FCALL                                      0  $3      
          6        ECHO                                                     $3
   17     7        INIT_DYNAMIC_CALL                                        !0
          8        SEND_VAL_EX                                              6
          9        DO_FCALL                                      0  $4      
         10        ECHO                                                     $4
         11      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V9L0R
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%2FV9L0R%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%2FV9L0R%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/V9L0R
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%2FV9L0R%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
193.06 ms | 1399 KiB | 14 Q