3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Doer { public function doThis(){ return 'did something'; } } class DoerDecorator { private $doer; public function __construct(Doer $doer){ $this->doer = $doer; } public function __call($name, $arguments){ return call_user_func_array([$this->doer, $name], $arguments); } public function doSomethingElse(){ return 'did something else'; } } $do = new DoerDecorator(new Doer); var_dump($do->doThis()); var_dump($do->doSomethingElse());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/945rY
function name:  (null)
number of ops:  17
compiled vars:  !0 = $do
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $1      'DoerDecorator'
          1        NEW                                              $2      'Doer'
          2        DO_FCALL                                      0          
          3        SEND_VAR_NO_REF_EX                                       $2
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   26     6        INIT_FCALL                                               'var_dump'
          7        INIT_METHOD_CALL                                         !0, 'doThis'
          8        DO_FCALL                                      0  $6      
          9        SEND_VAR                                                 $6
         10        DO_ICALL                                                 
   27    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !0, 'doSomethingElse'
         13        DO_FCALL                                      0  $8      
         14        SEND_VAR                                                 $8
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Class Doer:
Function dothis:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/945rY
function name:  doThis
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   'did+something'
    6     1*     > RETURN                                                   null

End of function dothis

End of class Doer.

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

End of function __construct

Function __call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/945rY
function name:  __call
number of ops:  11
compiled vars:  !0 = $name, !1 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        FETCH_OBJ_R                                      ~2      'doer'
          3        INIT_ARRAY                                       ~3      ~2
          4        ADD_ARRAY_ELEMENT                                ~3      !0
          5        INIT_USER_CALL                                0          'call_user_func_array', ~3
          6        SEND_ARRAY                                               !1
          7        CHECK_UNDEF_ARGS                                         
          8        DO_FCALL                                      0  $4      
          9      > RETURN                                                   $4
   18    10*     > RETURN                                                   null

End of function __call

Function dosomethingelse:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/945rY
function name:  doSomethingElse
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E > > RETURN                                                   'did+something+else'
   22     1*     > RETURN                                                   null

End of function dosomethingelse

End of class DoerDecorator.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.25 ms | 1400 KiB | 15 Q