3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bind($fn /* args... */) { $outer_args = func_get_args(); array_shift($outer_args); return function(/* args... */) use ($fn, $outer_args) { $inner_args = func_get_args(); return call_user_func_array($fn, array_merge($outer_args, $inner_args)); }; } $pkgs = array( 'pkg1', 'pkg2', 'pkg3' ); var_dump(array_map(bind('sprintf', 'pear install --alldeps %s %s', 'mypkg'), $pkgs));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qrMFJ
function name:  (null)
number of ops:  14
compiled vars:  !0 = $pkgs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   19     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'array_map'
          3        INIT_FCALL                                               'bind'
          4        SEND_VAL                                                 'sprintf'
          5        SEND_VAL                                                 'pear+install+--alldeps+%25s+%25s'
          6        SEND_VAL                                                 'mypkg'
          7        DO_FCALL                                      0  $2      
          8        SEND_VAR                                                 $2
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $3      
         11        SEND_VAR                                                 $3
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

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

End of function bind

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

End of function %00%7Bclosure%7D%2Fin%2FqrMFJ%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.16 ms | 1403 KiB | 22 Q