$_ENV is a superglobal that contains environment variables. Environment variables are provided by the shell under which PHP is running, so they may vary according to different shells.
You can display all your environment variables pronting out $_ENV:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<?php echo "<pre>"; print_r($_ENV); echo "</pre>"; /* ****environment variables on a mac machine**** Array ( [SHELL] => *** [TMPDIR] => *** [Apple_PubSub_Socket_Render] => *** [USER] => *** [SSH_AUTH_SOCK] => *** [__CF_USER_TEXT_ENCODING] => *** [PATH] => *** [PWD] => *** [HOME] => *** [SHLVL] => *** [DYLD_LIBRARY_PATH] => *** [LOGNAME] => *** [__LAUNCHD_FD] => *** [DISPLAY] => *** [_] => *** [COMMAND_MODE] => *** ) */ ?> |
To display an environment variable you can also use getenv()
1 2 3 |
<?php echo getenv('USER'); ?> |