Calling class functions using string variables?
| From: | Nick Richardson | Date: | Sun, 22 Sep 2002 19:49:36 +0000 |
| Subject: | Calling class functions using string variables? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-117195@lists.php.net to get a copy of this message | ||
Hi,
Anyone know if it's possible to call a class function using 2 string
variables WITHOUT instantiating the class?
i.e.:
$clName = "myClass";
$fuName = "myFunc";
$clName::$fuName();
I have tried several different combinations of eval and {} and just
about everything else I can think of… and they all give parse errors
when the class name is a string var. (i.e. myClass::$fuName() works fine
(as expected) but $clName::myFunc() does not). Everytime it doesn't
work, it just gives a simple parse error.
Any suggested are much appreciated!
Thanks in advance!
//Nick Richardson
// esoteric.web@gte.net
---
Outgoing mail is certified Virus Free. Can McAfee do that? - Hell NO!
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.386 / Virus Database: 218 - Release Date: 9/9/2002