3v4l.org

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

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

End of function foo

Function %00%7Bclosure%7D%2Fin%2FLOOZF%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LOOZF
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    4     2        INIT_FCALL                                               'str_repeat'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
    5     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FLOOZF%3A3%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.75 ms | 1399 KiB | 17 Q