note 30992 deleted from function.eval by didou
| From: | didou@php.net | Date: | Sun, 27 Jul 2003 17:03:28 +0000 |
| Subject: | note 30992 deleted from function.eval by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-52769@lists.php.net to get a copy of this message | ||
Note Submitter: arne.hartherz@gmx.net
----
It almost drove me mad getting the same error over and over again ("unexpected $ in ...... :
eval()'d line 1") when using the method from above (the one by Bart Koelman) to make my
globals available in a function.
The problem was simple: one of my variables contained quotes...
Try using this instead -- it works fine as I can see till now:
---cut---here---
reset ($GLOBALS);
while (list ($key, $val) = each ($GLOBALS))
{
$val = str_replace('"','\"',$val);
eval("\$" . "\$key = \"$val\";");
}
---cut---here---
Regards,
Arne