2 /* Prototype : bool unlink ( string $filename [, resource $context] );
3 Description : Deletes filename
5 <<__EntryPoint
>> function main(): void
{
7 echo "*** Testing unlink() on a file ***\n";
8 $filename = __SystemLib\
hphp_test_tmppath('unlink_basic.tmp'); // temp file name used here
9 $fp = fopen($filename, "w"); // create file
10 fwrite($fp, "Hello World");
14 var_dump( unlink($filename) );
15 var_dump( file_exists($filename) ); // confirm file doesnt exist
17 echo "\n*** Testing unlink() : checking second argument ***\n";
19 $context = stream_context_create();
20 // temp file name used here
21 $filename = __SystemLib\
hphp_test_tmppath('unlink_basic.tmp');
22 $fp = fopen($filename, "w"); // create file
26 var_dump( unlink($filename, $context) ); // using $context in second argument
27 var_dump( file_exists($filename) ); // confirm file doesnt exist