Nevermind, I have finally figured it out... I was missing a ; in the
eval statement.
For anyone who wanted to know, there's 2 ways...
1) the long way
$clName = myClass;
$fuName = myFunc;
$t = new $clName;
$t-$fuName();
unset($t);
2) the short way
$cl = myClass;
$fu = myFunc;
eval($cl::$fu(););
-Original Message-
From: Nick Richardson [mailto:[EMAIL PROTECTED]]
Sent: Sunday, September 22, 2002 12:50 PM
To: 'PHP General'
Subject: [PHP] Calling class functions using string variables?
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
// [EMAIL PROTECTED]
---
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
---
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php