3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface IService { public function interfaceFunction(); } final class ServiceWithOtherFunction implements IService { public function interfaceFunction() { echo "ServiceWithOtherFunction interfaceFunction\n"; } public function otherFunction() { echo "ServiceWithOtherFunction otherFunction\n"; } } final class Controller { private $service; public function __construct(IService $service) { $this->service = $service; } public function indexAction() { $this->service->interfaceFunction(); $this->service->otherFunction(); } } $controllerWithOtherFunction = new Controller(new ServiceWithOtherFunction); $controllerWithOtherFunction->indexAction(); final class ServiceWithoutOtherFunction implements IService { public function interfaceFunction() { echo "ServiceWithoutOtherFunction interfaceFunction\n"; } } $controllerWithoutOtherFunction = new Controller(new ServiceWithoutOtherFunction); $controllerWithoutOtherFunction->indexAction();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mZcRq
function name:  (null)
number of ops:  19
compiled vars:  !0 = $controllerWithOtherFunction, !1 = $controllerWithoutOtherFunction
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'servicewithotherfunction'
   32     1        NEW                                              $2      'Controller'
          2        NEW                                              $3      'ServiceWithOtherFunction'
          3        DO_FCALL                                      0          
          4        SEND_VAR_NO_REF_EX                                       $3
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $2
   34     7        INIT_METHOD_CALL                                         !0, 'indexAction'
          8        DO_FCALL                                      0          
   36     9        DECLARE_CLASS                                            'servicewithoutotherfunction'
   41    10        NEW                                              $8      'Controller'
         11        NEW                                              $9      'ServiceWithoutOtherFunction'
         12        DO_FCALL                                      0          
         13        SEND_VAR_NO_REF_EX                                       $9
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !1, $8
   43    16        INIT_METHOD_CALL                                         !1, 'indexAction'
         17        DO_FCALL                                      0          
         18      > RETURN                                                   1

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

End of function interfacefunction

End of class IService.

Class ServiceWithOtherFunction:
Function interfacefunction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mZcRq
function name:  interfaceFunction
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ECHO                                                     'ServiceWithOtherFunction+interfaceFunction%0A'
          1      > RETURN                                                   null

End of function interfacefunction

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

End of function otherfunction

End of class ServiceWithOtherFunction.

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

End of function __construct

Function indexaction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mZcRq
function name:  indexAction
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   FETCH_OBJ_R                                      ~0      'service'
          1        INIT_METHOD_CALL                                         ~0, 'interfaceFunction'
          2        DO_FCALL                                      0          
   28     3        FETCH_OBJ_R                                      ~2      'service'
          4        INIT_METHOD_CALL                                         ~2, 'otherFunction'
          5        DO_FCALL                                      0          
   29     6      > RETURN                                                   null

End of function indexaction

End of class Controller.

Class ServiceWithoutOtherFunction:
Function interfacefunction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mZcRq
function name:  interfaceFunction
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   ECHO                                                     'ServiceWithoutOtherFunction+interfaceFunction%0A'
          1      > RETURN                                                   null

End of function interfacefunction

End of class ServiceWithoutOtherFunction.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
194.53 ms | 1399 KiB | 13 Q