Object Context Question in object->object->variable
| From: | Sancar Saran | Date: | Mon, 02 Mar 2009 18:50:56 +0000 |
| Subject: | Object Context Question in object->object->variable | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-289059@lists.php.net to get a copy of this message | ||
Hello list.
I'm trying to implement someting on OO way.
I got 2 classes
class a {
var $config = array();
var $b = '';
function __construct {
$this->b = new b($this->config);
}
}
class b {
var $config = array();
function foo() {
switch($this->config['bar']) {
}
}
}
some where in class a
and when I call
$bar = new a();
$bar->b->foo();
I got
Fatal error: Using $this when not in object context in
Could you givme some clue what is wrong ?
I'm using Ubuntu and PHP 5.2.0-8+etch13
Regards
Sancar