3v4l.org

run code in 200+ PHP versions simultaneously
<?php interface Employee {} class SteelFactoryEmployee implements Employee {} class CarsFactoryEmployee implements Employee {} interface Factory { public function hire(Employee $employee): bool; } class SteelFactory implements Factory { public function hire(SteelFactoryEmployee $employee): bool { return true; } } class CarsFactory implements Factory { public function hire(CarsFactoryEmployee $employee): bool { return true; } } class EmploymentDepartment { public function hireNewEmployee(Factory $factory, Employee $employee): void { $factory->hire($employee); } } $someNewEmployee = new SteelFactoryEmployee(); $someFactory = new SteelFactory(); $employmentDepartment = new EmploymentDepartment(); $employmentDepartment->hireNewEmployee($someFactory, $someNewEmployee);
based on XFsLd
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RtM7Z
function name:  (null)
number of ops:  18
compiled vars:  !0 = $someNewEmployee, !1 = $someFactory, !2 = $employmentDepartment
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   5     0  E >   ADD_INTERFACE                                            'steelfactoryemployee'
   6     1        ADD_INTERFACE                                            'carsfactoryemployee'
  13     2        ADD_INTERFACE                                            'steelfactory'
  21     3        ADD_INTERFACE                                            'carsfactory'
  37     4        NEW                                              $3      :31
         5        DO_FCALL                                      0          
         6        QM_ASSIGN                                                !0
  38     7        NEW                                              $6      :27
         8        DO_FCALL                                      0          
         9        QM_ASSIGN                                                !1
  40    10        NEW                                              $9      :23
        11        DO_FCALL                                      0          
        12        QM_ASSIGN                                                !2
  41    13        INIT_METHOD_CALL                                         !2, 'hireNewEmployee'
        14        SEND_VAR_EX                                              !1
        15        SEND_VAR_EX                                              !0
        16        DO_FCALL                                      0          
        17      > RETURN                                                   1

Class Employee: [no user functions]
Class SteelFactoryEmployee: [no user functions]
Class CarsFactoryEmployee: [no user functions]
Class Factory:
Function hire:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RtM7Z
function name:  hire
number of ops:  3
compiled vars:  !0 = $employee
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  10     0  E >   RECV                                             !0      
         1        VERIFY_RETURN_TYPE                                       
         2      > RETURN                                                   null

End of function hire

End of class Factory.

Class SteelFactory:
Function hire:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RtM7Z
function name:  hire
number of ops:  4
compiled vars:  !0 = $employee
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  15     0  E >   RECV                                             !0      
  17     1      > RETURN                                                   <true>
  18     2*       VERIFY_RETURN_TYPE                                       
         3*     > RETURN                                                   null

End of function hire

End of class SteelFactory.

Class CarsFactory:
Function hire:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RtM7Z
function name:  hire
number of ops:  4
compiled vars:  !0 = $employee
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  23     0  E >   RECV                                             !0      
  25     1      > RETURN                                                   <true>
  26     2*       VERIFY_RETURN_TYPE                                       
         3*     > RETURN                                                   null

End of function hire

End of class CarsFactory.

Class EmploymentDepartment:
Function hirenewemployee:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RtM7Z
function name:  hireNewEmployee
number of ops:  6
compiled vars:  !0 = $factory, !1 = $employee
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  31     0  E >   RECV                                             !0      
         1        RECV                                             !1      
  33     2        INIT_METHOD_CALL                                         !0, 'hire'
         3        SEND_VAR_EX                                              !1
         4        DO_FCALL                                      0          
  34     5      > RETURN                                                   null

End of function hirenewemployee

End of class EmploymentDepartment.

Generated using Vulcan Logic Dumper, using php 7.4.0