GETENV(3) 1 GETENV(3)
getenv - Gets the value of an environment variable
SYNOPSIS
string getenv (string $varname)
DESCRIPTION
Gets the value of an environment variable.
You can see a list of all the environmental variables by using phpinfo(3). Many of these variables are listed within RFC 3875, specifi-
cally section 4.1, "Request Meta-Variables".
PARAMETERS
o $varname
- The variable name.
RETURN VALUES
Returns the value of the environment variable $varname, or FALSE if the environment variable $varname does not exist.
EXAMPLES
Example #1
getenv(3) Example
<?php
// Example use of getenv()
$ip = getenv('REMOTE_ADDR');
// Or simply use a Superglobal ($_SERVER or $_ENV)
$ip = $_SERVER['REMOTE_ADDR'];
?>
SEE ALSO
putenv(3), apache_getenv(3), Superglobals.
PHP Documentation Group GETENV(3)