3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = function ($v) { return $v * 2; }; $y = function ($v) { return $v * 2; }; $z = function ($v) { return $v * 200; }; $compose_ = function ($documentation) { $closures = func_get_args(); array_shift($closures); // er($args,'$args'); return function ($param = null) use ($documentation, $closures) { if (!$param) { return $documentation; } $first_closure = array_shift($closures); $val = $first_closure($param); foreach ($closures as $closure) { $val = $closure($val); } return $val; }; }; $c = $compose_('Compose of Int -> $x -> $y -> $z -> Int', $x, $y, $z); echo $c(); echo $c(345);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/plSKI
function name:  (null)
number of ops:  23
compiled vars:  !0 = $x, !1 = $y, !2 = $z, !3 = $compose_, !4 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FplSKI%3A2%240'
          1        ASSIGN                                                   !0, ~5
    6     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FplSKI%3A6%241'
          3        ASSIGN                                                   !1, ~7
   10     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FplSKI%3A10%242'
          5        ASSIGN                                                   !2, ~9
   14     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FplSKI%3A14%243'
          7        ASSIGN                                                   !3, ~11
   29     8        INIT_DYNAMIC_CALL                                        !3
          9        SEND_VAL_EX                                              'Compose+of+Int+-%3E+%24x+-%3E+%24y+-%3E+%24z+-%3E+Int'
         10        SEND_VAR_EX                                              !0
         11        SEND_VAR_EX                                              !1
         12        SEND_VAR_EX                                              !2
         13        DO_FCALL                                      0  $13     
         14        ASSIGN                                                   !4, $13
   30    15        INIT_DYNAMIC_CALL                                        !4
         16        DO_FCALL                                      0  $15     
         17        ECHO                                                     $15
   31    18        INIT_DYNAMIC_CALL                                        !4
         19        SEND_VAL_EX                                              345
         20        DO_FCALL                                      0  $16     
         21        ECHO                                                     $16
         22      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FplSKI%3A2%240

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

End of function %00%7Bclosure%7D%2Fin%2FplSKI%3A6%241

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

End of function %00%7Bclosure%7D%2Fin%2FplSKI%3A10%242

Function %00%7Bclosure%7D%2Fin%2FplSKI%3A14%243:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/plSKI
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $documentation, !1 = $closures
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        FUNC_GET_ARGS                                    ~2      
          2        ASSIGN                                                   !1, ~2
   16     3        INIT_FCALL                                               'array_shift'
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
   18     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FplSKI%3A18%244'
          7        BIND_LEXICAL                                             ~5, !0
          8        BIND_LEXICAL                                             ~5, !1
   26     9      > RETURN                                                   ~5
   27    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FplSKI%3A14%243

Function %00%7Bclosure%7D%2Fin%2FplSKI%3A18%244:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/plSKI
function name:  {closure}
number of ops:  24
compiled vars:  !0 = $param, !1 = $documentation, !2 = $closures, !3 = $first_closure, !4 = $val, !5 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV_INIT                                        !0      null
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
   19     3        BOOL_NOT                                         ~6      !0
          4      > JMPZ                                                     ~6, ->6
          5    > > RETURN                                                   !1
   20     6    >   INIT_FCALL                                               'array_shift'
          7        SEND_REF                                                 !2
          8        DO_ICALL                                         $7      
          9        ASSIGN                                                   !3, $7
   21    10        INIT_DYNAMIC_CALL                                        !3
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0  $9      
         13        ASSIGN                                                   !4, $9
   22    14      > FE_RESET_R                                       $11     !2, ->21
         15    > > FE_FETCH_R                                               $11, !5, ->21
   23    16    >   INIT_DYNAMIC_CALL                                        !5
         17        SEND_VAR_EX                                              !4
         18        DO_FCALL                                      0  $12     
         19        ASSIGN                                                   !4, $12
   22    20      > JMP                                                      ->15
         21    >   FE_FREE                                                  $11
   25    22      > RETURN                                                   !4
   26    23*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FplSKI%3A18%244

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.14 ms | 1404 KiB | 15 Q