Ok, this may be confusing, but bear with me.
I have a page which the code is layed out in several user defined functions. One of these functions calls setcookie(). In another function, I need to be able to access information (vars, functions) from a class that I have written out in a config file. Now, since I am using include() to bring the config.php file into the current script, I cannot call it in the global scope (outside of all the functions) since setcookie() must be called before any headers are sent. Here is an example:
function one()
{
setcookie("blah", "whatever", "forever");
}
function two()
{
include("config.php");
$objClass = new myClass();
print("<pre>\r");
var_dump($objClass);
print("</pre>\r");
}
Now, the problem lies in the fact that when I use this code, and call two(), the class $objClass fails to retain any of it's variable values. I am POSITIVE that the class variables are set. All that is echo'd out to the browser in this case is the structure of the class, sans values of course. Now, if I were to do it like so:
if ($whatever)
{
setcookie("blah", "whatever", "forever");
}
else if ($somethingElse)
{
include("config.php");
$objClass = new myClass();
print("<pre>\r");
var_dump($objClass);
print("</pre>\r");
}
I would get the class structure AND it's variable values. However, on this particular page, I have a multitude of user defined functions and really don't want to have a big IF statement.
I know this may seem weird, but any suggestions?