3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Doll { function __invoke(); } class LargeDoll implements Doll { private $inner; function __construct(Doll $inner) { $this->inner = $inner; } function __invoke() { return ($this->inner)() . ' world'; } } class SmallDoll implements Doll { function __invoke() { return 'hello'; } } $russian = new LargeDoll(new SmallDoll()); var_dump($russian());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NsfQ0
function name:  (null)
number of ops:  14
compiled vars:  !0 = $russian
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'largedoll'
   23     1        DECLARE_CLASS                                            'smalldoll'
   31     2        NEW                                              $1      'LargeDoll'
          3        NEW                                              $2      'SmallDoll'
          4        DO_FCALL                                      0          
          5        SEND_VAR_NO_REF_EX                                       $2
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !0, $1
   33     8        INIT_FCALL                                               'var_dump'
          9        INIT_DYNAMIC_CALL                                        !0
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

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

End of function __invoke

End of class Doll.

Class LargeDoll:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NsfQ0
function name:  __construct
number of ops:  4
compiled vars:  !0 = $inner
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   14     1        ASSIGN_OBJ                                               'inner'
          2        OP_DATA                                                  !0
   15     3      > 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/NsfQ0
function name:  __invoke
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                      ~0      'inner'
          1        INIT_DYNAMIC_CALL                                        ~0
          2        DO_FCALL                                      0  $1      
          3        CONCAT                                           ~2      $1, '+world'
          4      > RETURN                                                   ~2
   20     5*     > RETURN                                                   null

End of function __invoke

End of class LargeDoll.

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

End of function __invoke

End of class SmallDoll.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.59 ms | 1450 KiB | 14 Q