Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

11 Block Size Suggested block size for I/O to file, -1 under Windows.


12 Number of
Blocks
Number of blocks used by file, -1 under Windows.


boolean symlink(string source, string destination)


The symlink function creates a symbolic link to the source argument with the name in
the destination argument. To create a hard link, use the link function.


<?
//link moredata.txt to existing file data.txt
if(symlink("data.txt", "moredata.txt"))
{
print("Symbolic link created");
}
else
{
print("Symbolic link not created");
}
?>


integer tmpfile()


The tmpfile function opens a new temporary file and returns its file handle. This handle
may be used in the same way as one returned by fopen using anupdate mode. When you
close the file, or your script ends, the file will beremoved. This function is a wrapper for
the C function of the same name. If for some reason a temporary file cannot be created,
FALSE is returned.


<?
//open a temporary file
$fp = tmpfile();


//write 10K of random data
//to simulate some process
for($i=0; $i<10240; $i++)
{
//randomly choose a letter
//from a range of printables
fputs($fp, chr(rand(ord(' '), ord('z'))));
}


//return to start of file
rewind($fp);


//dump and close file,
//therefore deleting it
fpassthru($fp);

Free download pdf