Let’s say I got the class name with get_class($this) within an abstract class method.
How can I also get the file name in which this class was defined? (full path)
I know I could pass it as an argument to my child class and create a property which is accessible in the parent class, but I was wondering if PHP has something built-in
What you need is the
ReflectionObjectclass and its method,ReflectionClass::getFileName.Check the function’s manual here.