This is probably impossible but i thought i would ask around and see if i missed something. What im looking for is a way of using functions that require file pointer handle without the need to write an actual file.
I know i could use a temporary file, do my operations then read the file back into the output buffer and delete the file. However this means latency from writing to disk then reading from the disk. It would be far better for speed and resources in my case if i could just do something like
$tmp = createFakeFile();
fputscsv($tmp, array(/*** an array of csv fields ***/));
echo $tmp;
I doubt this exists but if you’ve ever heard of a way of doing something like this i’d love to hear about it
Thanks
You can use php://memory and php://temp wrapper files for this.
Cite:
http://php.net/manual/en/wrappers.php.php