note 19601 added to ref.classobj
| From: | saryon_no_spam_ at unfix dot chek dot com | Date: | Tue, 05 Mar 2002 14:46:58 +0000 |
| Subject: | note 19601 added to ref.classobj | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27374@lists.php.net to get a copy of this message | ||
Something nice i found out when i was trying to do with classes what i knew could be done with
functions: they can be dynamically loaded/used.
ex:
class a
{
function bla()
{
echo "1\n";
}
}
class b
{
function bla()
{
echo "2\n";
}
}
$class = "a";
$test = new $class;
$test->bla();
$class2 = "a";
$test2 = new $class2;
$test2->bla();
-----------------------
This will print:
1
2
------------------
For those of you who were considering doing something with plugins....use this to your
advantage :)
makes life soooo easy, this :)
Sar
--
http://www.php.net/manual/en/ref.classobj.php
http://master.php.net/manage/user-notes.php?action=edit+19601
http://master.php.net/manage/user-notes.php?action=delete+19601
http://master.php.net/manage/user-notes.php?action=reject+19601