"finding the php file (at run time) where a class was defined" Answer’s

0

Try ReflectionClass

  • ReflectionClass::getFileName — Gets a filename

Example:

class Foo {}
$reflector = new ReflectionClass('Foo');
echo $reflector->getFileName();

This will return false when the filename cannot be found, e.g. on native classes.

Wednesday, March 31, 2021
 
braindamage
answered 11 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share