tempnam

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Create file with unique file name
<?php tempnam(string $directory, string $prefix): string|false
<?php         $path = realpath($path) ?: $path;



        $tempPath = tempnam(dirname($path), basename($path));




        if (! is_null($mode)) {
<?php             ViewFacade::addLocation(sys_get_temp_dir());

        }



        $tempFileInfo = pathinfo(tempnam($tempDirectory, 'laravel-blade'));



        $tempFile = $tempFileInfo['dirname'].'/'.$tempFileInfo['filename'].'.blade.php';
<?php     protected function setUp(): void

    {

        $this->path = @tempnam('tmp', 'file_failed_job_provider_test');

        $this->provider = new FileFailedJobProvider($this->path);

    }
<?php use Symfony\Component\Process\Process;



$run = function () {

    $junitLogFile = tempnam(sys_get_temp_dir(), 'junit');



    $process = new Process(

        array_merge(['php', 'bin/pest', '--log-junit', $junitLogFile], func_get_args()),
<?php         $filesystem = new Filesystem();

        $filesystem->mirror(__DIR__.'/../Fixtures', $this->tempDir);



        $this->tempFile = tempnam(sys_get_temp_dir(), 'webmozart_GlobIteratorTest');

    }



    protected function tearDown(): void
<?php             return false;

        }



        $tmpFile = tempnam(sys_get_temp_dir(), '');

        $script = $tmpFile.'.vbs';

        rename($tmpFile, $script);
<?php         if ((null === $scheme || 'file' === $scheme || 'gs' === $scheme) && '' === $suffix) {

            $tmpFile = @tempnam($hierarchy, $prefix);




            if (false !== $tmpFile) {
<?php     protected function createTempFile(?string $dir = null): string

    {

        $dir = $dir ?? sys_get_temp_dir();

        $name = tempnam($dir, 'c');

        if ($name === false) {

            throw new \UnexpectedValueException('tempnam failed to create a temporary file in '.$dir);

        }
<?php         if ('Linux' === PHP_OS) {

            $this->fifoPath = tempnam(sys_get_temp_dir(), 'react-');



            unlink($this->fifoPath);
<?php             return parent::createStream();

        }



        $this->fifoPath = tempnam(sys_get_temp_dir(), 'react-');



        unlink($this->fifoPath);
<?php                     $parsedBody = [];

                    foreach ($document->getParts() as $part) {

                        if ($part->isFile()) {

                            $tmpPath = tempnam(sys_get_temp_dir(), 'bref_upload_');

                            if ($tmpPath === false) {

                                throw new RuntimeException('Unable to create a temporary directory');

                            }