3v4l.org

run code in 500+ PHP versions simultaneously
<?php class CallableStringifier { private static $callables = array(); public static function stringify($callable) { $id = count(self::$callables); self::$callables[$id] = $callable; return 'return ' . __CLASS__ . "::call($id, func_get_args());"; } public static function call($id, $args) { return call_user_func_array(self::$callables[$id], $args); } } $func = create_function('$arg1', CallableStringifier::stringify(function($arg1) { return $arg1; })); echo $func(1); // outputs 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ivMri
function name:  (null)
number of ops:  14
compiled vars:  !0 = $func
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL_BY_NAME                                           'create_function'
          1        SEND_VAL_EX                                                  '%24arg1'
          2        INIT_STATIC_METHOD_CALL                                      'CallableStringifier', 'stringify'
          3        DECLARE_LAMBDA_FUNCTION                              ~1      [0]
   22     4        SEND_VAL                                                     ~1
   20     5        DO_FCALL                                          0  $2      
   22     6        SEND_VAR_NO_REF_EX                                           $2
   20     7        DO_FCALL                                          0  $3      
          8        ASSIGN                                                       !0, $3
   24     9        INIT_DYNAMIC_CALL                                            !0
         10        SEND_VAL_EX                                                  1
         11        DO_FCALL                                          0  $5      
         12        ECHO                                                         $5
         13      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ivMri
function name:  {closure:/in/ivMri:20}
number of ops:  3
compiled vars:  !0 = $arg1
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   RECV                                                 !0      
   21     1      > RETURN                                                       !0
   22     2*     > RETURN                                                       null

End of Dynamic Function 0

Class CallableStringifier:
Function stringify:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ivMri
function name:  stringify
number of ops:  13
compiled vars:  !0 = $callable, !1 = $id
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
    9     1        FETCH_STATIC_PROP_R              unknown             ~2      'callables'
          2        COUNT                                                ~3      ~2
          3        ASSIGN                                                       !1, ~3
   10     4        FETCH_STATIC_PROP_W              unknown             $5      'callables'
          5        ASSIGN_DIM                                                   $5, !1
          6        OP_DATA                                                      !0
   11     7        ROPE_INIT                                         3  ~8      '%3A%3Acall%28'
          8        ROPE_ADD                                          1  ~8      ~8, !1
          9        ROPE_END                                          2  ~7      ~8, '%2C+func_get_args%28%29%29%3B'
         10        CONCAT                                               ~10     'return+CallableStringifier', ~7
         11      > RETURN                                                       ~10
   12    12*     > RETURN                                                       null

End of function stringify

Function call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ivMri
function name:  call
number of ops:  10
compiled vars:  !0 = $id, !1 = $args
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   16     2        FETCH_STATIC_PROP_R              unknown             ~2      'callables'
          3        FETCH_DIM_R                                          ~3      ~2, !0
          4        INIT_USER_CALL                                    0          'call_user_func_array', ~3
          5        SEND_ARRAY                                                   !1
          6        CHECK_UNDEF_ARGS                                             
          7        DO_FCALL                                          1  $4      
          8      > RETURN                                                       $4
   17     9*     > RETURN                                                       null

End of function call

End of class CallableStringifier.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
196.53 ms | 2738 KiB | 8 Q