note 31435 added to function.eval
| From: | dr dot mabuse at addcom dot de | Date: | Mon, 21 Apr 2003 21:57:54 +0000 |
| Subject: | note 31435 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46913@lists.php.net to get a copy of this message | ||
In some examples above the following snipplet is being used:
reset ($HTTP_POST_VARS);
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
//do something crazy with the $val
eval("\$" . "\$key = \"$val\";");
}
Actually you don't need eval to do this!
Remember that PHP has this already built in.
Just use this snipplet:
reset ($_POST);
while (list($key,$val) = each($_POST))
{
$$key = $val;
}
The '$$' does the job! HTH
--
http://www.php.net/manual/en/function.eval.php
http://master.php.net/manage/user-notes.php?action=edit+31435
http://master.php.net/manage/user-notes.php?action=delete+31435
http://master.php.net/manage/user-notes.php?action=reject+31435