Currently, I have the following code:


class overall {
var $loaded;

function load($class){
//eval("global \$$class;"); // This didn't work either
$this->loaded[] = $class;
eval("\$this->$class = new $class;");
return true;

class foo {
var $bar;

// Constructor
function bar(){
$this->bar = 1;
echo $this->bar."<br>";

// Start actual loading
$overall = new overall;

foreach($overall->loaded as $key=>$val){
$key =& $overall->$key;


// it doesn't understand this
$foo->bar(); // line 42

It all works, except for the $foo->bar(); thing... I am wondering how I can turn $overall->foo->bar() to $foo->bar(); as all the things I've tried, don't work, they don't give any errors, except for
Fatal error: Call to a member function on a non-object in d:\apache\htdocs\classes.php on line 42...

Could anyone help me with this?

- Tularis

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to