PHP » I/O » tmpfile()

Syntax:
int tmpfile()

Returns a handle to a temporary file.

This function creates a writable temporary file that will be automatically removed by PHP when it is closed or the script ends. If the call succeeds, a file handle will be returned. Otherwise, FALSE is returned.

Examples

Code:
<?php

$fh = tmpfile();
fputs($fh, "some temp data");
fseek($fh, 0);
print fgets($fh);
fclose($fh);

?>
Output:
some temp data
Explanation:

A temporary file is opened, and some data written to it and read back out.