3v4l.org

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

Function lambda:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aonDS
function name:  lambda
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'lambda'
    5     1        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
          2      > RETURN                                                   ~2
    6     3*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aonDS
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $b, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        CONCAT                                           ~2      !1, !0
          2      > RETURN                                                   ~2
          3*     > RETURN                                                   null

End of Dynamic Function 0

End of function lambda

Function closure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aonDS
function name:  closure
number of ops:  5
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, 'closure'
   10     1        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
          2        BIND_LEXICAL                                             ~2, !0
          3      > RETURN                                                   ~2
   11     4*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aonDS
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $b, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        CONCAT                                           ~2      !1, !0
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of Dynamic Function 0

End of function closure

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.33 ms | 1005 KiB | 16 Q