[PHP] Re: Including variables

2002-09-26 Thread Erwin

 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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: Including variables

2002-09-26 Thread Marek Kilimajer

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


  



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php