0

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.

fstab
  • 4,801
  • 8
  • 34
  • 66

1 Answers1

1

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)

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
  • serialize is a nice function, but I need to use `import` or `require` in order to use the PHP internal caching system for the sources. I cannot do a file read operation every time the page is loaded. – fstab Jan 25 '13 at 09:44