wiki/content/20201116142105-tempnam.md

22 lines
429 B
Markdown
Raw Normal View History

2024-05-06 20:40:05 +00:00
---
2024-10-30 17:04:36 +00:00
date: 20201116
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'
```