I inherited a php driven site that uses a somewhat strange approach.
There is a big database with code snippets.
The response is generated by extracting those snippets from the database and then combining them.
Some snippets contain only client-side code, these are just echo-ed.
But some snippets contain php code - pure php or mixed php + client-side code.
Now, these are handled as follows:
1. code snippet is read from the database to a string variable
2. the content of this variable is written to a temporary file
3. this temporary file is require()-d, which dumps the code from the database into the current .php
4. the temporary file is destroyed
This works OK but I want to avoid the unnecessary file i/o operations if possible, so I want to skip creating, require() -ing and deleting the temporary file.
My question is, is it possible to require() the variable content directly, without having to save the variable content to a file first, but to achieve the same result ?