PHP tmpfile() Function

PHP tmpfile() Function


Define :

In this tutorial we have to learned about PHP tmpfile() Function.The tmpfile() Function inbuilt function in php.This function is used to create a temporary file with a unique name in read-write (w+) mode.
The file created using tmpfile() function gets automatically deleted when close using fclose() or when there are no remaining references to the file handle.
The end of the script also results in the removal of the temporary file created using tmpfile() function.
The tmpfile() function takes no parameters and it returns a file handle which is similar to the one returned by fopen(), for the new file or FALSE on failure.

Syntax :
  tmpfile()

Given below example shows the usage of PHP tmpfile() Function :

Output : test file, test file.