Object caching (!!!)
| From: | Rad0s-ław Gajewski | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Object caching (!!!) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108632@lists.php.net to get a copy of this message | ||
I think there is a bug in PHP4.2.1, but maybe you would
find a solution.
What I want to do is object caching so that i could work
on two objects which are realy the only one object like:
$a=new A();
$a->name="Leon";
$b=new A();
$b->surname="Galeon";
echo $a->name.$a->surname;
echo $b->name.$b->surname;
should give me Leon.Galeon twice
That's how i want to do this:
class A {
var $name="noName";
var $surname="noSurname";
function A() {
if ($GLOBALS["cache"]) {
$this=&$GLOBALS["cache"];
} else {
$GLOBALS["cache"]=&$this;
}
}
}
$a=&new A();
$b=&new B(); //here is not good, $b is a copy
$a->name="Leon"; //$cache will be changed too so it's ok
echo $b->name;
will produce "noName";
THX!Please cc my priv mail.
--
--
pozdr
Rad0s
Radek Gajewski rgajew@sgh.waw.pl GG:694459 ICQ:110153822
--------------------------------------------------------