execute methods dynamically
| From: | Rainer Hahnekamp | Date: | Sun, 20 Mar 2005 17:47:20 +0000 |
| Subject: | execute methods dynamically | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-211140@lists.php.net to get a copy of this message | ||
Hello everybody,
I want to write a method in version 4 that executes a method of an object.
As parameter the classname and the methodname is passed:
function executeMethod($classname, $methodname) {
$object = new $classname();
$object->$methodname();
}
This does not work. What am I doing wrong?
Greetings,
-Rainer Hahnekamp