Re: Re: Including variables

From: Date: Thu, 26 Sep 2002 12:40:59 +0000
Subject: Re: Re: Including variables
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-117706@lists.php.net to get a copy of this message
Just dont forget that eval assumes php code, so escape from it first using ?> Erwin wrote:
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


« previous php.general (#117706) next »