As suggested by user Baba, do this - variables_order = "EGPCS" in the relevant php.ini file.
Then in the "Environment Variables" (Control -> Advanced system settings) add a new environment variable key value. Then restart the server. Use the following to check if the CONSTANT exists-
defined('YOUR_ENV_VAR') || define('YOUR_ENV_VAR', (getenv('YOUR_ENV_VAR') ? getenv('YOUR_ENV_VAR') : 'put_your_default_value_here'));
Use this new environment variable values as the value of a CONSTANT in your code. So, if the Environment Variable is set to -
C:/foo ... in Environment Variables
The code below will pick up this value.
defined('MY_VARIABLE') || define('MY_VARIABLE', (getenv('MY_VARIABLE') ? getenv('MY_VARIABLE') : 'C:/bar'));
However, if the EV is not there then the default value (C:/bar) will be used.
You can use the above to dynamically define your PRODUCTION and DEVELOPMENT environments without the need to change the code.