Re: Proposal for 2 new magic constants
| From: | Jordi Kroon | Date: | Sat, 23 May 2026 18:57:14 +0000 |
| Subject: | Re: Proposal for 2 new magic constants | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130996@lists.php.net to get a copy of this message | ||
On 23/05/2026 8:42 pm, php@s22.us wrote:
Unless I'm missing something, I don't see the problem of having PHP return that information, since it already does so. E.g. __DIR__ will return: /home/username/path/to/dirThis assumes your project code lives somewhere in a subfolder within
$HOME. In many situations, that is not the case at all. For example, it could simply be /app. Or, as a result of a chroot, /home/username may not be exposed at all. Instead, __DIR__ would simply return /path/to/dir.
Perhaps a magic constant would be the wrong way to do it, but in my thinking, it would fit right in with __FILE__, __DIR__, etc.If it were to fit in with __FILE__, then it should be a magic constant. But I do not think it fits there. It should be an environment variable because it belongs to the runtime environment. -- Regards, Jordi Kroon