class MyClass implements MyInterface1, MyInterface2 { // class implementation } $obj = new ReflectionClass('MyClass'); $interfaces = $obj->getInterfaceNames(); print_r($interfaces);
Array ( [0] => MyInterface1 [1] => MyInterface2 )
class MyLibraryClass { // class implementation } $obj = new ReflectionClass('MyLibraryClass'); $interfaces = $obj->getInterfaceNames(); print_r($interfaces);
Array ( )In this example, the `MyLibraryClass` class does not implement any interfaces. The `getInterfaceNames` method is called on a `ReflectionClass` object that represents the `MyLibraryClass` class. The method returns an empty array. Package library: Based on the examples, it is not possible to determine the package or library being used as the classes and interfaces are not prefixed with a package or namespace.