3v4l.org

run code in 200+ 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 >   ADD_INTERFACE                                            'servicewithotherfunction'
  32     1        NEW                                              $2      :33
         2        NEW                                              $3      :33
         3        DO_FCALL                                      0          
         4        SEND_VAR_NO_REF_EX                                       $3
         5        DO_FCALL                                      0          
         6        QM_ASSIGN                                                !0
  34     7        INIT_METHOD_CALL                                         !0, 'indexAction'
         8        DO_FCALL                                      0          
  36     9        ADD_INTERFACE                                            'servicewithoutotherfunction'
  41    10        NEW                                              $8      :23
        11        NEW                                              $9      :23
        12        DO_FCALL                                      0          
        13        SEND_VAR_NO_REF_EX                                       $9
        14        DO_FCALL                                      0          
        15        QM_ASSIGN                                                !1
  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 >   ASSIGN_OBJ                                               '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 >   ASSIGN_OBJ                                               '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_SUB                                    8          '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 >   ASSIGN_OBJ                                               'ServiceWithoutOtherFunction+interfaceFunction%0A'
         1      > RETURN                                                   null

End of function interfacefunction

End of class ServiceWithoutOtherFunction.

Generated using Vulcan Logic Dumper, using php 7.4.0