Computer >> Computer tutorials >  >> Programming >> PHP

tempnam() function in PHP


The tempnam() function creates a temporary file with a file name which is unique.

Syntax

tempnam(dir, prefix)

Parameters

  • dir − The directory where the temporary file will get created.

  • prefix − The beginning of the file

Return

The tempnam() function returns the new temporary filename or FALSE on failure.

Example

<?php
   echo tempnam("C:\test\new","TMP");
?>

Output

C:\test\new\TMP1.tmp