objects forget about their attributes!
| From: | Jens Kisters | Date: | Tue, 08 Aug 2000 08:18:42 +0000 |
| Subject: | objects forget about their attributes! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-10601@lists.php.net to get a copy of this message | ||
I'm stuck with a weird behavior of my application framework's objects,
or php objects in general:
I create an instance of a class, feed an attribute from a class method
an try to access the attribute from outside the class:
<?
class test {
var $pSubItems;
function modify()
{
echo "modifying the attribute which is currently set to
".$this->pSubitems."<br>";
$this->pSubitems["test"]["test"]=1;
echo "In here its :".$this->pSubitems."<br>";
}
}
$t=new test;
$t->modify();
echo "why not here?".$t->pSubItems."<br> So lets try something
else...<br>";
$t->pSubItems=5;
echo "Its definately *not* an array:".$t->pSubItems."<br>";
$t->modify();
echo "I modified it, for god's sake!, but it's
still:".$t->pSubItems."<br>";
?>
see attach temp2.php
i guess i could stick to the old set and get methods, but quite i'm
lazy.
Why is an objects attribute diffrent when you are inside the object?
this can't be right.
the System is SuSe Linux 6.3
Apache, argh, i'll attach the output of phpversion() in case anyone is
interested in the exact configuration
--
Grüße aus Weeze
Jens Kisters
rosomm et partner
Holtumsweg 12
47652 Weeze
Telefon: 0 28 37 - 96 23 73
http://www.rosomm-partner.de