Dynamic Function with return?
| From: | bskolb | Date: | Fri, 27 Aug 2004 22:59:07 +0000 |
| Subject: | Dynamic Function with return? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-194972@lists.php.net to get a copy of this message | ||
Sample Code:
//================================
<?PHP // version 4.3.6
function testFunction($foo) {
return $foo=="TEST";
}
function wrapper($foofunc, $foovar) {
return eval("return $foofunc($foovar);");
}
echo wrapper("testFunction", "TEST");
?>
//================================
This code works. It calls the function and
receives the appropriate return value.
But, is there a better way of doing this?
It seems a bit round-a-bout.
Thanks!