3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen($a) { $closure = function () use ($a) { return $a; }; $a++; return $closure; } $closure = gen(42); echo $closure, "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pqK6i
function name:  (null)
number of ops:  7
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'gen'
          1        SEND_VAL                                                 42
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
    9     4        ECHO                                                     !0
          5        ECHO                                                     '%0A'
          6      > RETURN                                                   1

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

End of function gen

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

End of function %00%7Bclosure%7D%2Fin%2FpqK6i%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.26 ms | 1398 KiB | 14 Q