PHP tmpfile() functi
Definition and Usage
The tmpfile() functi creates a temporary file with a unique filename in read-write (w+) mode.
The file will be automatically deleted after closing (using fclose()) or when the script ends.
Syntax
tmpfile()
Hint and Comments
Hint:See also tempnam().
Example
<?php $temp = tmpfile(); fwrite($temp, "Testing, testing."); //Go back to the beginning of the file rewind($temp); //Read 1k from file echo fread($temp,1024); //Delete file fclose($temp); ?>
Output:
Testing, testing.