3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $_instNum; function __construct() { static $i = 0; $this->_instNum = $i++; $GLOBALS["_fooInst{$this->_instNum}"] = $this; eval("function _invokeFoo{$this->_instNum}() { \$args = func_get_args(); return call_user_func_array(array(\$GLOBALS['_fooInst{$this->_instNum}'], '__invoke'), \$args); }"); } function __invoke() { return 'goal!'; } function __toString() { return "_invokeFoo{$this->_instNum}"; } } $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/RAasF
function name:  (null)
number of ops:  9
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'foo'
   22     1        NEW                                              $1      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   23     4        ADD                                              ~4      '', !0
          5        INIT_USER_CALL                                0          'call_user_func', ~4
          6        DO_FCALL                                      0  $5      
          7        ECHO                                                     $5
          8      > RETURN                                                   1

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

End of function __tostring

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.78 ms | 1390 KiB | 13 Q