putenv

(PHP 4, PHP 5, PHP 7)

putenvSets the value of an environment variable

Description

putenv ( string $setting ) : bool

Adds setting to the server environment. The environment variable will only exist for the duration of the current request. At the end of the request the environment is restored to its original state.

Parameters

setting

The setting, like "FOO=BAR"

Return Values

Returns true on success or false on failure.

Examples

Example #1 Setting an environment variable

<?php
putenv("UNIQID=$uniqid");
?>

See Also

© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/function.putenv.php