either use serialize instead of var_export (and then use normal file operations) or make your dumper a bit more intelligent, adding variable itself to the dump (making it $var=dump;
, not just dump
)
php include as rvalue?
Question
I wonder if it is possible to use php include
as a Rvalue, like this example:
$foo = include('bar.php);
I did a few experiments but it seems to not be possible.
The php files that I would like to load in this way are cached dumps of objects and arrays, saved with the var_export()
function.
It is quite important to me to load those file with import
(or require
) and not with the normal file operations in order to get the full advantage of PHP's internal code caching system.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow