OOP question
| From: | Jackson Miller | Date: | Sun, 01 Jun 2003 06:39:13 +0000 |
| Subject: | OOP question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-149706@lists.php.net to get a copy of this message | ||
Is it possible to reference two instances of an object at once with a
single variable name while retaining the ability to reference the
objects seperately?
I am using the PEAR Template IT package and need to generate two similar
but different results at the same time. I am doing this with two
instances of the IT class ($tpl1 and $tpl2).
I have some code like this:
$tpl1->setVariable("var1","This");
$tpl2->setVariable("var1","This");
$tpl1->setVariable("var2","That");
$tpl2->setVariable("var2","That");
$tpl1->setVariable("var3","Something");
$tpl2->setVariable("var3","SomethingElse");
I would like for this to be:
$tpl3->setVariable("var1","This");
$tpl3->setVariable("var2","That");
$tpl1->setVariable("var3","Something");
$tpl2->setVariable("var3","SomethingElse");
Where $tpl3 is a reference to both $tpl1 and $tpl2.
Is this possible at all? It seems to make for very clean code for me,
but I can't think of how it could be possible.
Thanks in advance.
-Jackson