PHP __DIR__ evaluated runtime (late binding)?
问题 Is it somehow possible to get the location of PHP file, evaluated at runtime? I am seeking something similar to the magic constant __DIR__ , but evaluated at runtime, as a late binding. Similar difference with self and static : __DIR__ ~ self ??? ~ static My goal is defining a method in an abstract class, using __DIR__ which would be evaluated respectively for each heir class. Example: abstract class Parent { protected function getDir() { // return __DIR__; // does not work return <<I need