__DIR__ VS using Reflection

mdirice

New Member
In Symfony2, I saw the code like below:\[code\] if (null === $this->rootDir) { $r = new \ReflectionObject($this); $this->rootDir = dirname($r->getFileName()); }\[/code\]why not just use the \[code\]__DIR__\[/code\]?\[code\] if (null === $this->rootDir) { $this->rootDir = __DIR__; }\[/code\]What is difference between them?
 
Top