3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { var $_instNum; function __construct() { static $i = 0; $this->_instNum = $i++; $GLOBALS["_fooInst$i"] = $this; eval("function _invokeFoo$i() { return call_user_func_array(array(\$GLOBALS['_fooInst$i'], '__invoke'), func_get_args()); }"); } function __invoke() { return 'goal!'; } function __toString() { $funcName = ('_hack' . $n++); } } $foo = new Foo; echo call_user_func($foo);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aspML
function name:  (null)
number of ops:  8
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'foo'
   20     1        NEW                                              $1      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   21     4        INIT_USER_CALL                                0          'call_user_func', !0
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
          7      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aspML
function name:  __construct
number of ops:  17
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
    7     1        POST_INC                                         ~2      !0
          2        ASSIGN_OBJ                                               '_instNum'
          3        OP_DATA                                                  ~2
    8     4        NOP                                                      
          5        FAST_CONCAT                                      ~4      '_fooInst', !0
          6        FETCH_THIS                                       ~6      
          7        FETCH_W                      global              $3      'GLOBALS'
          8        ASSIGN_DIM                                               $3, ~4
          9        OP_DATA                                                  ~6
    9    10        ROPE_INIT                                     5  ~8      'function+_invokeFoo'
         11        ROPE_ADD                                      1  ~8      ~8, !0
         12        ROPE_ADD                                      2  ~8      ~8, '%28%29+%7B+return+call_user_func_array%28array%28%24GLOBALS%5B%27_fooInst'
         13        ROPE_ADD                                      3  ~8      ~8, !0
         14        ROPE_END                                      4  ~7      ~8, '%27%5D%2C+%27__invoke%27%29%2C+func_get_args%28%29%29%3B+%7D'
         15        INCLUDE_OR_EVAL                                          ~7, EVAL
   10    16      > RETURN                                                   null

End of function __construct

Function __invoke:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aspML
function name:  __invoke
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > RETURN                                                   'goal%21'
   13     1*     > RETURN                                                   null

End of function __invoke

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aspML
function name:  __toString
number of ops:  5
compiled vars:  !0 = $funcName, !1 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   POST_INC                                         ~2      !1
          1        CONCAT                                           ~3      '_hack', ~2
          2        ASSIGN                                                   !0, ~3
   17     3        VERIFY_RETURN_TYPE                                       
          4      > RETURN                                                   null

End of function __tostring

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.52 ms | 1399 KiB | 13 Q