3v4l.org

run code in 300+ PHP versions simultaneously
<?php function o($f, $g) { return function (...$x) { return $f(...$g(...$x)); }; } $f = function ($a, $b) { return [$a + $b, $a * $b]; }; $g = function (...$n) { return array_map(function ($n) { return n ** 2; }, $n); }; $h = o($f, $g); var_dump($h(2, 3));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JgJOv
function name:  (null)
number of ops:  17
compiled vars:  !0 = $f, !1 = $g, !2 = $h
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FJgJOv%3A10%241'
          1        ASSIGN                                                   !0, ~3
   14     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FJgJOv%3A14%242'
          3        ASSIGN                                                   !1, ~5
   20     4        INIT_FCALL                                               'o'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !2, $7
   22     9        INIT_FCALL                                               'var_dump'
         10        INIT_DYNAMIC_CALL                                        !2
         11        SEND_VAL_EX                                              2
         12        SEND_VAL_EX                                              3
         13        DO_FCALL                                      0  $9      
         14        SEND_VAR                                                 $9
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

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

End of function o

Function %00%7Bclosure%7D%2Fin%2FJgJOv%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JgJOv
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $x, !1 = $f, !2 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV_VARIADIC                                    !0      
    6     1        INIT_DYNAMIC_CALL                                        !1
          2        INIT_DYNAMIC_CALL                                        !2
          3        SEND_UNPACK                                              !0
          4        CHECK_UNDEF_ARGS                                         
          5        DO_FCALL                                      1  $3      
          6        SEND_UNPACK                                              $3
          7        CHECK_UNDEF_ARGS                                         
          8        DO_FCALL                                      1  $4      
          9      > RETURN                                                   $4
    7    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FJgJOv%3A5%240

Function %00%7Bclosure%7D%2Fin%2FJgJOv%3A10%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JgJOv
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        ADD                                              ~2      !0, !1
          3        INIT_ARRAY                                       ~3      ~2
          4        MUL                                              ~4      !0, !1
          5        ADD_ARRAY_ELEMENT                                ~3      ~4
          6      > RETURN                                                   ~3
   12     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FJgJOv%3A10%241

Function %00%7Bclosure%7D%2Fin%2FJgJOv%3A14%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JgJOv
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV_VARIADIC                                    !0      
   15     1        INIT_FCALL                                               'array_map'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FJgJOv%3A15%243'
   17     3        SEND_VAL                                                 ~1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
   18     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FJgJOv%3A14%242

Function %00%7Bclosure%7D%2Fin%2FJgJOv%3A15%243:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JgJOv
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        FETCH_CONSTANT                                   ~1      'n'
          2        POW                                              ~2      ~1, 2
          3      > RETURN                                                   ~2
   17     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FJgJOv%3A15%243

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.4 ms | 1403 KiB | 18 Q