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
ew","TMP"); ?>

Output

C:\test
ew\TMP1.tmp

Updated on: 30-Jul-2019

217 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements