1--TEST--
2Test unlink() function : usage variations - unlink links
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') {
6    die('skip only on Linux');
7}
8?>
9--FILE--
10<?php
11
12/* Delete link files - soft and hard links */
13
14$file_path = __DIR__;
15// temp file used
16$filename = "$file_path/unlink_variation3.tmp";
17
18echo "*** Testing unlink() on soft and hard links ***\n";
19// create temp file
20$fp = fopen($filename, "w");
21fclose($fp);
22// link name used here
23$linkname = "$file_path/unlink_variation3_link.tmp";
24
25echo "-- Testing unlink() on soft link --\n";
26// create soft link
27var_dump( symlink($filename, $linkname) );  // expected: true
28// unlink soft link
29var_dump( unlink($linkname) );  // expected: true
30var_dump( file_exists($linkname) );  // confirm link is deleted
31
32echo "-- Testing unlink() on hard link --\n";
33// create hard link
34var_dump( link($filename, $linkname) );  // expected: true
35// delete hard link
36var_dump( unlink($linkname) );  // expected: true
37var_dump( file_exists($linkname) );  // confirm link is deleted
38
39// delete temp file
40var_dump( unlink($filename) );
41var_dump( file_exists($filename) );  // confirm file is deleted
42
43echo "Done\n";
44?>
45--EXPECT--
46*** Testing unlink() on soft and hard links ***
47-- Testing unlink() on soft link --
48bool(true)
49bool(true)
50bool(false)
51-- Testing unlink() on hard link --
52bool(true)
53bool(true)
54bool(false)
55bool(true)
56bool(false)
57Done
58