Hi all,
I would like to propose two new magic constants to PHP: __HOME__ and
__USER__
These would allow us easy ways to get the following information in our
scripts:
Constant Results
__USER__ username
__HOME__ /home/username
To get that info now we have to resort to things like:
define('HOME_PATH', implode('/', array_slice(explode('/', __DIR__), 0,
3)));
define('USER_NAME', explode('/', HOME_PATH)[2]);
Personally, I use these a lot and it would be nice to call a simple
constant instead of a line of code. I think others could benefit from
them, as well, hence my proposal.
So, I'd like to hear what others think before presenting an RFC. Do
they sound beneficial to anyone else?
Thanks,
Marc
P.S. Hopefully I'm posting this to the correct list. If not, please
point me to where I need to be.