wiki/content/20201116142105-tempnam.md

22 lines
431 B
Markdown
Raw Permalink Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:34:11 +00:00
date: 2020-11-16
2024-05-06 20:40:05 +00:00
id: 030ab7e7-9b0f-4be2-8a62-28b82640ddb7
title: tempnam()
---
# Description
Like the PHP `tempnam()` function this method creates a file with a
unique name in the given directory.
# Syntax
``` php
use Symfony\Component\Filesystem\Filesystem;
$fs = new Filesystem();
$fs->tempnam('/tmp', 'report_'); // '/tmp/report_Um3nlH'
$fs->tempnam('/tmp', 'report_', '.pdf'); // '/tmp/report_Um3nlH.pdf'
```