putenv

bool putenv(int setting) 

Places a value into the server environment.

Returns:

TRUE on success; FALSE on error

Description:

Places a variable and its value into the server environment, which can then be accessed by other scripts or programs.

If PHP is running in safe mode, a list of environment variables that can be altered can be set in the PHP initialization file.

Example:

Display current PHP version
putenv("HELLO=world"); 
echo getenv("HELLO"); 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.