views:

21

answers:

1

Hi!

I need to know the path of a file in which an interface is defined. I know the name and the interface is available (the file was included at another location in the code). I know things like __FILE__, etc. but the point is, it's only an interface, i do not have an instance. Ironically, i need the path to find a suitable implementation for the interface.

Does anyone know a way to find the path?

Thanks for your help!

A: 

Despite the name, ReflectionClass works on interfaces too. So you can use

$interface = new ReflectionClass('IFoo');
echo $interface->getFilename();
Gordon
Yes, it works. Thank you very much!
Ben