3v4l.org

run code in 300+ PHP versions simultaneously
<?php function callWithArgs(callable $callback, ...$args) { return function(...$params) use($callback, $args) { $args = array_merge($params, $args); return $callback(...$args); }; } $t = callWithArgs('substr', 0, 5); $string = 'Lorem ipsum dolor simet'; var_dump( $t($string) ); // "Lorem"
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7gpMu
function name:  (null)
number of ops:  14
compiled vars:  !0 = $t, !1 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'callwithargs'
          1        SEND_VAL                                                 'substr'
          2        SEND_VAL                                                 0
          3        SEND_VAL                                                 5
          4        DO_FCALL                                      0  $2      
          5        ASSIGN                                                   !0, $2
   13     6        ASSIGN                                                   !1, 'Lorem+ipsum+dolor+simet'
   15     7        INIT_FCALL                                               'var_dump'
          8        INIT_DYNAMIC_CALL                                        !0
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function callwithargs:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7gpMu
function name:  callWithArgs
number of ops:  7
compiled vars:  !0 = $callback, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_VARIADIC                                    !1      
    4     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F7gpMu%3A4%240'
          3        BIND_LEXICAL                                             ~2, !0
          4        BIND_LEXICAL                                             ~2, !1
    8     5      > RETURN                                                   ~2
    9     6*     > RETURN                                                   null

End of function callwithargs

Function %00%7Bclosure%7D%2Fin%2F7gpMu%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7gpMu
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $params, !1 = $callback, !2 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV_VARIADIC                                    !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
    5     3        INIT_FCALL                                               'array_merge'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $3      
          7        ASSIGN                                                   !2, $3
    7     8        INIT_DYNAMIC_CALL                                        !1
          9        SEND_UNPACK                                              !2
         10        CHECK_UNDEF_ARGS                                         
         11        DO_FCALL                                      1  $5      
         12      > RETURN                                                   $5
    8    13*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.55 ms | 1403 KiB | 18 Q