2 /* Prototype: bool is_file ( string $filename );
3 Description: Tells whether the filename is a regular file
4 Returns TRUE if the filename exists and is a regular file
7 /* Testing is_file() with file containing data, truncating its size
8 and the file created by touch() */
9 <<__EntryPoint
>> function main(): void
{
11 echo "-- Testing is_file() with file containing data --\n";
12 $filename = __SystemLib\
hphp_test_tmppath('is_file_variation1.tmp');
13 $file_handle = fopen($filename, "w" );
14 fwrite( $file_handle, "Hello, world....." ); // exptected true
16 var_dump( is_file($filename) );
19 echo "\n-- Testing is_file() after truncating filesize to zero bytes --\n";
20 $file_handle = fopen($filename, "r");
21 ftruncate($file_handle, 0);
23 var_dump( is_file($filename) ); // expected true
27 echo "\n-- Testing is_file() with an empty file --\n";
28 /* created by fopen() */
29 fclose( fopen($filename, "w") );
30 var_dump( is_file($filename) ); //expected true
34 /* created by touch() */
36 var_dump( is_file($filename) ); // expected true
40 echo "\n*** Done ***";