3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); $sampleFunction = function(int $a, int $b, int $c) { return sprintf("a=%d; b=%d; c=%d", $a, $b, $c); }; $partialFunction = function(Closure $function, int $argument) { return function(...$args) use ($function, $argument) { return $function($argument, ...$args); }; }; $p = $partialFunction($sampleFunction, 1); $p1 = $partialFunction($p, 2); $p2 = $partialFunction($p1, 4); echo $p2();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iC7hK
function name:  (null)
number of ops:  23
compiled vars:  !0 = $sampleFunction, !1 = $partialFunction, !2 = $p, !3 = $p1, !4 = $p2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FiC7hK%3A4%240'
          1        ASSIGN                                                   !0, ~5
    9     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FiC7hK%3A9%241'
          3        ASSIGN                                                   !1, ~7
   16     4        INIT_DYNAMIC_CALL                                        !1
          5        SEND_VAR_EX                                              !0
          6        SEND_VAL_EX                                              1
          7        DO_FCALL                                      0  $9      
          8        ASSIGN                                                   !2, $9
   17     9        INIT_DYNAMIC_CALL                                        !1
         10        SEND_VAR_EX                                              !2
         11        SEND_VAL_EX                                              2
         12        DO_FCALL                                      0  $11     
         13        ASSIGN                                                   !3, $11
   18    14        INIT_DYNAMIC_CALL                                        !1
         15        SEND_VAR_EX                                              !3
         16        SEND_VAL_EX                                              4
         17        DO_FCALL                                      0  $13     
         18        ASSIGN                                                   !4, $13
   19    19        INIT_DYNAMIC_CALL                                        !4
         20        DO_FCALL                                      0  $15     
         21        ECHO                                                     $15
         22      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FiC7hK%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iC7hK
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    6     3        INIT_FCALL                                               'sprintf'
          4        SEND_VAL                                                 'a%3D%25d%3B+b%3D%25d%3B+c%3D%25d'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $3      
          9      > RETURN                                                   $3
    7    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FiC7hK%3A4%240

Function %00%7Bclosure%7D%2Fin%2FiC7hK%3A9%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iC7hK
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $function, !1 = $argument
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FiC7hK%3A11%242'
          3        BIND_LEXICAL                                             ~2, !0
          4        BIND_LEXICAL                                             ~2, !1
   13     5      > RETURN                                                   ~2
   14     6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FiC7hK%3A9%241

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

End of function %00%7Bclosure%7D%2Fin%2FiC7hK%3A11%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.62 ms | 1392 KiB | 15 Q