2 /* Prototype: string tempnam ( string $dir, string $prefix );
3 Description: Create file with unique file name.
6 /* Trying to create unique files by passing previously created unique file name as prefix */
7 <<__EntryPoint
>> function main(): void
{
8 $file_path = __SystemLib\
hphp_test_tmppath('sandbox');
11 echo "\n*** Test tempnam(): by passing previously created filenames ***\n";
12 $file_name = "tempnam_variation6.tmp";
13 for($i=1; $i<=3; $i++
) {
14 echo "-- Iteration $i --\n";
15 $file_name = tempnam("$file_path", $file_name);
17 if( file_exists($file_name) ) {
18 echo "File name is => ";
22 echo "File created in => ";
23 $file_dir = dirname($file_name);
25 if ($file_dir == sys_get_temp_dir()) {
28 else if ($file_dir == $file_path) {
29 echo "directory specified\n";
32 echo "unknown location\n";
39 echo "\n*** Done ***\n";