3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ff(&$var) { return $var; } class A { public function __construct($f) { $this->f = $f; } public function __invoke() { $args = array(); foreach ((array) func_get_args() as &$arg) { $args[] = &$arg; } return call_user_func_array($this->f, $args); } } $a = new A('ff'); echo call_user_func_array($a, array('A'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LHmcu
function name:  (null)
number of ops:  10
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'A'
          1        SEND_VAL_EX                                              'ff'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   25     4        INIT_USER_CALL                                0          'call_user_func_array', !0
          5        SEND_ARRAY                                               <array>
          6        CHECK_UNDEF_ARGS                                         
          7        DO_FCALL                                      0  $4      
          8        ECHO                                                     $4
          9      > RETURN                                                   1

Function ff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LHmcu
function name:  ff
number of ops:  3
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1      > RETURN                                                   !0
    5     2*     > RETURN                                                   null

End of function ff

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LHmcu
function name:  __construct
number of ops:  4
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        ASSIGN_OBJ                                               'f'
          2        OP_DATA                                                  !0
   11     3      > RETURN                                                   null

End of function __construct

Function __invoke:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 126) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/LHmcu
function name:  __invoke
number of ops:  16
compiled vars:  !0 = $args, !1 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   16     1        FUNC_GET_ARGS                                    ~3      
          2        CAST                                          7  ~4      ~3
          3      > FE_RESET_RW                                      $5      ~4, ->8
          4    > > FE_FETCH_RW                                              $5, !1, ->8
   17     5    >   FETCH_DIM_W                                      $6      !0
          6        ASSIGN_REF                                               $6, !1
   16     7      > JMP                                                      ->4
          8    >   FE_FREE                                                  $5
   19     9        FETCH_OBJ_R                                      ~8      'f'
         10        INIT_USER_CALL                                0          'call_user_func_array', ~8
         11        SEND_ARRAY                                               !0
         12        CHECK_UNDEF_ARGS                                         
         13        DO_FCALL                                      0  $9      
         14      > RETURN                                                   $9
   20    15*     > RETURN                                                   null

End of function __invoke

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.45 ms | 1399 KiB | 13 Q