I'm with the camp that is anti-globals. 🙂 This could be a case where some object-oriented programming might be called for. You could create a class that has related functions (methods) grouped within it, and which make use of a class variable which would store this "global" value you want them all to use.
<?php
class Example
{
private $myVar;
public function __construct($var)
{
$this->myVar = $var;
}
public function foo()
{
return "Foo " . $this->myVar;
}
public function bar()
{
return "Bar " . $this->myVar;
}
public function fubar()
{
return "Fubar " . $this->myVar;
}
public function set($value)
{
$this->myVar = $value;
}
}
$test = new Example("Value 1");
echo $test->foo();
echo "<br />\n";
$test->set("New value");
echo $test->fubar();