#21971 [Com]: include() and Variables

From: Date: Thu, 30 Jan 2003 23:08:05 +0000
Subject: #21971 [Com]: include() and Variables
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-31711@lists.php.net to get a copy of this message
ID: 21971 Comment by: michael.mauch@gmx.de Reported By: josephmferris@cox.net Status: Open Bug Type: Feature/Change Request Operating System: All PHP Version: 4.3.0 New Comment: I'm not sure what you mean by "accept a variable as input". a) php -r '$s = "./hmm.php"; include($s);' Works for me. b) <http://www.php.net/manual/en/function.eval.php> Previous Comments: ------------------------------------------------------------------------ [2003-01-30 16:56:00] josephmferris@cox.net What follows is a feature request. Searching the existing feature requests have not turned up any similar results. I have found that it might be convenient to allow include() and/or require() to be able to accept a variable as input. A couple of scenarios that this might be useful: * Caching script segments * Evaluating PHP inside of templates My workaround has been to dump a variable to disk and then include it as a file, after determining a unique file name to use. After including the file, it was deleted from disk. This was for a templating system that could recursively include other templates that may or may not include php. The reason for the approach was to reuse php as a the template scripting language, as well. Performance on my test server has been okay, but I am sure that with a large amount of traffic, the file i/o would slow the process down considerably. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21971&edit=1

« previous php.bugs (#31711) next »