2 /* Prototype: string tempnam ( string $dir, string $prefix );
3 Description: Create file with unique file name.
6 /* Passing an existing file as $prefix for tempnam() fn */
8 $file_path = dirname(__FILE__
);
10 echo "*** Test tempnam() function: by passing an existing filename as prefix ***\n";
11 $dir_name = $file_path."/tempnam_variation6";
13 $h = fopen($dir_name."/tempnam_variation6.tmp", "w");
15 for($i=1; $i<=3; $i++
) {
16 echo "-- Iteration $i --\n";
17 $created_file = tempnam("$dir_name", "tempnam_variation6.tmp");
19 if( file_exists($created_file) ) {
20 echo "File name is => ";
25 print("File is not created");
27 unlink($created_file);
30 unlink($dir_name."/tempnam_variation6.tmp");
33 echo "\n*** Done ***\n";