1--TEST--
2Testing unlink() function : basic functionality
3--FILE--
4<?php
5
6$file_path = __DIR__;
7
8echo "*** Testing unlink() on a file ***\n";
9$filename = "$file_path/unlink_basic.tmp";  // temp file name used here
10$fp = fopen($filename, "w");  // create file
11fwrite($fp, "Hello World");
12fclose($fp);
13
14// delete file
15var_dump( unlink($filename) );
16var_dump( file_exists($filename) );  // confirm file doesn't exist
17
18echo "\n*** Testing unlink() : checking second argument ***\n";
19// creating a context
20$context = stream_context_create();
21// temp file name used here
22$filename = "$file_path/unlink_basic.tmp";
23$fp = fopen($filename, "w");  // create file
24fclose($fp);
25
26// delete file
27var_dump( unlink($filename, $context) );  // using $context in second argument
28var_dump( file_exists($filename) );  // confirm file doesn't exist
29
30echo "Done\n";
31?>
32--EXPECT--
33*** Testing unlink() on a file ***
34bool(true)
35bool(false)
36
37*** Testing unlink() : checking second argument ***
38bool(true)
39bool(false)
40Done
41