3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Pipeline{ public static function make_pipeline(...$funcs){ return function($args) use ($funcs){ foreach($funcs as $func){ $args = $func($args); } return $args; }; } } $c = new Pipeline(); $fun = $c::make_pipeline(function($x){ return $x*3; },function($x){ return $x-1;}, function($x){return $x/2;}); echo $fun(3); // should print 4
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fDdCb
function name:  (null)
number of ops:  18
compiled vars:  !0 = $c, !1 = $fun
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $2      'Pipeline'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   15     3        FETCH_CLASS                                   0  $5      !0
          4        INIT_STATIC_METHOD_CALL                                  $5, 'make_pipeline'
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfDdCb%3A15%241'
          6        SEND_VAL_EX                                              ~6
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfDdCb%3A15%242'
          8        SEND_VAL_EX                                              ~7
          9        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfDdCb%3A15%243'
         10        SEND_VAL_EX                                              ~8
         11        DO_FCALL                                      0  $9      
         12        ASSIGN                                                   !1, $9
   16    13        INIT_DYNAMIC_CALL                                        !1
         14        SEND_VAL_EX                                              3
         15        DO_FCALL                                      0  $11     
         16        ECHO                                                     $11
         17      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FfDdCb%3A5%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/fDdCb
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $args, !1 = $funcs, !2 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    6     2      > FE_RESET_R                                       $3      !1, ->9
          3    > > FE_FETCH_R                                               $3, !2, ->9
    7     4    >   INIT_DYNAMIC_CALL                                        !2
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $4      
          7        ASSIGN                                                   !0, $4
    6     8      > JMP                                                      ->3
          9    >   FE_FREE                                                  $3
    9    10      > RETURN                                                   !0
   10    11*     > RETURN                                                   null

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

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

End of function %00%7Bclosure%7D%2Fin%2FfDdCb%3A15%241

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

End of function %00%7Bclosure%7D%2Fin%2FfDdCb%3A15%242

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

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

Class Pipeline:
Function make_pipeline:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fDdCb
function name:  make_pipeline
number of ops:  5
compiled vars:  !0 = $funcs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV_VARIADIC                                    !0      
    5     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfDdCb%3A5%240'
          2        BIND_LEXICAL                                             ~1, !0
   10     3      > RETURN                                                   ~1
   11     4*     > RETURN                                                   null

End of function make_pipeline

End of class Pipeline.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.7 ms | 1403 KiB | 13 Q