1--TEST--
2Test unlink() function : usage variations - unlink file in use
3--FILE--
4<?php
5/* Prototype : bool unlink ( string $filename [, resource $context] );
6   Description : Deletes filename
7*/
8
9/* Try to unlink file when file handle is still in use */
10
11$file_path = __DIR__;
12
13echo "*** Testing unlink() on a file which is in use ***\n";
14// temp file name used here
15$filename = "$file_path/unlink_variation2.tmp";
16
17// create file
18$fp = fopen($filename, "w");
19// try unlink() on $filename
20var_dump( unlink($filename) );  // expected: true on linux
21var_dump( file_exists($filename) );  // confirm file is deleted
22// now close file handle
23fclose($fp);
24
25echo "Done\n";
26?>
27--EXPECT--
28*** Testing unlink() on a file which is in use ***
29bool(true)
30bool(false)
31Done
32