Getting environment variables
Get environment variable value: getenv()
The function getenv()
retrieves the value of an environment variable.
The function has an optional parameter: the name of the variable.
It returns a string with the value of the variable.
For example, in order to display the environment variable PATH
:
If you use a name of variable that does not exist, it returns the boolean value false
:
All environment variables
If you call the function without any parameter all environment variables will be returned as an array
: