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 RtM7Z
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pT2Cb
function name:  (null)
number of ops:  29
compiled vars:  !0 = $someNewEmployee, !1 = $someFactory, !2 = $employmentDepartment
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
   5     1        DECLARE_CLASS                                    $4      'steelfactoryemployee'
         2        ADD_INTERFACE                                            $4, 'Employee'
         3        VERIFY_ABSTRACT_CLASS                                    $4
   6     4        DECLARE_CLASS                                    $5      'carsfactoryemployee'
         5        ADD_INTERFACE                                            $5, 'Employee'
         6        VERIFY_ABSTRACT_CLASS                                    $5
   8     7        NOP                                                      
  13     8        DECLARE_CLASS                                    $7      'steelfactory'
         9        ADD_INTERFACE                                            $7, 'Factory'
        10        VERIFY_ABSTRACT_CLASS                                    $7
  21    11        DECLARE_CLASS                                    $8      'carsfactory'
        12        ADD_INTERFACE                                            $8, 'Factory'
        13        VERIFY_ABSTRACT_CLASS                                    $8
  29    14        NOP                                                      
  37    15        NEW                                              $10     :39
        16        DO_FCALL                                      0          
        17        ASSIGN                                                   !0, $10
  38    18        NEW                                              $13     :35
        19        DO_FCALL                                      0          
        20        ASSIGN                                                   !1, $13
  40    21        NEW                                              $16     :31
        22        DO_FCALL                                      0          
        23        ASSIGN                                                   !2, $16
  41    24        INIT_METHOD_CALL                                         !2, 'hireNewEmployee'
        25        SEND_VAR_EX                                              !1
        26        SEND_VAR_EX                                              !0
        27        DO_FCALL                                      0          
        28      > 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/pT2Cb
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/pT2Cb
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/pT2Cb
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/pT2Cb
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.3.0