php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #21971 include() and Variables
Submitted: 2003-01-30 16:56 UTC Modified: 2003-01-30 17:13 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: josephmferris at cox dot net Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.3.0 OS: All
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
21 - 10 = ?
Subscribe to this entry?

 
 [2003-01-30 16:56 UTC] josephmferris at cox dot 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-30 17:08 UTC] michael dot mauch at gmx dot de
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>
 [2003-01-30 17:12 UTC] josephmferris at cox dot net
Michael hit the nail on the head with option b.  I am sorry to have wasted everyone's time.  Truly, I searched and searched and have never come accross this function before.  Must be getting old.
 [2003-01-30 17:13 UTC] josephmferris at cox dot net
Closing the issue, since it is not valid.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 21:01:28 2024 UTC