1--TEST-- 2Test unlink() function : variation 3--CREDITS-- 4Dave Kelsey <d_kelsey@uk.ibm.com> 5--FILE-- 6<?php 7/* Prototype : bool unlink(string filename[, context context]) 8 * Description: Delete a file 9 * Source code: ext/standard/file.c 10 * Alias to functions: 11 */ 12 13echo "*** Testing unlink() : variation: contexts and relative files ***\n"; 14 15// test relative directories and stream contexts. 16$subdir = 'subdir'; 17$testfile = $subdir.'/testfile.txt'; 18mkdir($subdir); 19touch($testfile); 20f_exists($testfile); 21$context = stream_context_create(); 22var_dump(unlink($testfile, $context)); 23f_exists($testfile); 24rmdir($subdir); 25 26function f_exists($file) { 27 if (file_exists($file) == true) { 28 echo "$file exists\n"; 29 } 30 else { 31 echo "$file doesn't exist\n"; 32 } 33} 34?> 35===DONE=== 36--EXPECT-- 37*** Testing unlink() : variation: contexts and relative files *** 38subdir/testfile.txt exists 39bool(true) 40subdir/testfile.txt doesn't exist 41===DONE=== 42