CLASS Problem
| From: | Bocskai Stefan | Date: | Fri, 05 May 2000 14:41:59 +0000 |
| Subject: | CLASS Problem | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-18463@lists.php.net to get a copy of this message | ||
Hi,
I'm a beginer in PHP and I already have a greate problem with the classes:
Please see this example:
<?
class xx{
var $child;
var $table = array();
var $i;
function xx($i){
$this->i = $i;
if ($i<10) $this->child = new xx($i+1);
}// end of constructor
function propag()
{
// this function is auto porpaging into objects
// and set the value of $table["ABC"];
$this->table["ABC"] = "1234567890";
$u = $this->child;
if (gettype($u) == "object" )
$u->propag();
}
}//end of class xx
// and then ....
$test = new xx(0);
$test->propag();
$child = $test->child;
$child2 = $child->child;
echo "The value of child is : ".$child2->table["ABC"];
echo "<br> level: ".$child2->i;
?>
Whay I cannot see the value of table["ABC"]? At the same time the
"level" apear ....
Thank you,
Bebe