3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bind($cb) { $bound_args = func_get_args(); array_shift($bound_args); $bound_exec = function () use ($bound_args, $cb) { var_dump(func_get_args()); $args = $bound_args + func_get_args(); var_dump($args); call_user_func_array($cb, $args); }; return $bound_exec; } $fn = bind(function ($a, $b) { return $a . $b; }, 'hello '); echo $fn('world');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gKsv8
function name:  (null)
number of ops:  11
compiled vars:  !0 = $fn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'bind'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FgKsv8%3A14%241'
          2        SEND_VAL                                                 ~1
          3        SEND_VAL                                                 'hello+'
          4        DO_FCALL                                      0  $2      
          5        ASSIGN                                                   !0, $2
   15     6        INIT_DYNAMIC_CALL                                        !0
          7        SEND_VAL_EX                                              'world'
          8        DO_FCALL                                      0  $4      
          9        ECHO                                                     $4
         10      > RETURN                                                   1

Function bind:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gKsv8
function name:  bind
number of ops:  12
compiled vars:  !0 = $cb, !1 = $bound_args, !2 = $bound_exec
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        FUNC_GET_ARGS                                    ~3      
          2        ASSIGN                                                   !1, ~3
    5     3        INIT_FCALL                                               'array_shift'
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    6     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FgKsv8%3A6%240'
          7        BIND_LEXICAL                                             ~6, !1
          8        BIND_LEXICAL                                             ~6, !0
          9        ASSIGN                                                   !2, ~6
   12    10      > RETURN                                                   !2
   13    11*     > RETURN                                                   null

End of function bind

Function %00%7Bclosure%7D%2Fin%2FgKsv8%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gKsv8
function name:  {closure}
number of ops:  17
compiled vars:  !0 = $bound_args, !1 = $cb, !2 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
    7     2        INIT_FCALL                                               'var_dump'
          3        FUNC_GET_ARGS                                    ~3      
          4        SEND_VAL                                                 ~3
          5        DO_ICALL                                                 
    8     6        FUNC_GET_ARGS                                    ~5      
          7        ADD                                              ~6      !0, ~5
          8        ASSIGN                                                   !2, ~6
    9     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
   10    12        INIT_USER_CALL                                0          'call_user_func_array', !1
         13        SEND_ARRAY                                               !2
         14        CHECK_UNDEF_ARGS                                         
         15        DO_FCALL                                      0          
   11    16      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FgKsv8%3A6%240

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

End of function %00%7Bclosure%7D%2Fin%2FgKsv8%3A14%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.19 ms | 1403 KiB | 18 Q