I have exported an array using var_export($var,true); and stored it to a file arraystore.php
When I include arraystore.php on another page and try to use the array it doesn’t work? should it, or is there a way to import the var for use in the new page? Maybe serialising and sending as the constructor of the class in use on the second page? would that work?
var_export()is not intended to be a data-interchange format. It’s a debug statement. If you want to save some objects for future, serialize it instead. It handles character encoding properly as well.And you can easily read it back:
This method avoids using
eval(). It is almost evil.Still, you can use JSON for the store format.