ya, globals are the best
try this on for size:
<?
class worldObject {
var $name = "No Name";
function belch() {
echo "braaaaaaaaaaaaaap!!!<br>\n";
}
function drink() {
echo "mmmmmmm beeeeeeer!<br>\n";
}
} // end Class
$GLOBALS['fred'] = new worldObject;
$GLOBALS['fred']->name = "Fred";
echo "Hi, I'm ". $GLOBALS['fred']->name."<BR>";
function doSomething() {
$GLOBALS['fred']->burb();
}
doSomething();
function doSomethingElse() {
$GLOBALS['fred']->drink();
}
doSomethingElse();
$GLOBALS['fred']->name = "Barney";
echo "Hi, I'm ". $GLOBALS['fred']->name."<BR>";
?>
And there you have a Global object that you can do whatever you want with from anywhere in your scripts.
A handy thing to check out sometime is:
<?
print_r($GLOBALS);
?>
...will dump the GLOBALS[] to the page.