Re: Including variables
| From: | Erwin | Date: | Thu, 26 Sep 2002 10:15:49 +0000 |
| Subject: | Re: Including variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117688@lists.php.net to get a copy of this message | ||
> I'm having quite a dumb problem with PHP... It's probably more a
> result
> of brain freeze than anything else, but if anyone could help it'd be
> very much appreciated.
>
> Basically, I need to include() the contents of a variable. Saving the
> contents to a temporary file and then using include() would be
> inconvenient.
Try using eval (http://www.php.net/eval),
You could also write the contents to a file generated in a tempfile.
Generate the filename with tempnam (http://www.php.net/tempnam), open it,
fill it with the contents of the variable, close it, include it and delete
it (with unlink, http://www.php.net/unlink).
HTH
Erwin