note 36439 added to function.eval
| From: | Mauro at rn2 dot php dot net | Date: | Thu, 09 Oct 2003 14:43:59 +0000 |
| Subject: | note 36439 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-58138@lists.php.net to get a copy of this message | ||
If you want do a call to a function with a dynamic name you can:
foreach($dir as $dirname => $id_dir)
{
$comando="".$dirname."_namefunction(".$var.")";
// $comando is: namefunction1_name($var);
eval("\$var_returned = $comando;");
// $var_returned contains the value returned from the
// namefunction1_name
}
Bye ;-)
----
Manual Page -- http://www.php.net/manual/en/function.eval.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36439
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36439&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36439&report=yes
Search -- http://master.php.net/manage/user-notes.php