I use a conf.inc.php to define some Global variables since I roll out several copies of the same code over and over and need an easy place to edit some basic string variables.
My question is if someone knows how to reference a local variable (local to where the Global is called) in the Global variable.
simplified example of what works:
conf.inc.php file:
$GLOBALS['favcolor'] = "My favorite color is %s.";
Some other php file where I call that Global:
include_once("../conf.inc.php");
$color = "green";
printf($GLOBALS['favcolor'], $color);
//output is: My favorite color is green.
In the above example I would much prefer defining the Global variable in conf.inc.php as:
$GLOBALS['favcolor'] = "My favorite color is $color.";
...but this of course references a local variable in conf.inc.php named $color not in the second PHP file where the Global is called.
What is the syntax in the Global declaration so that the variable $color references the local variable in the second php file?