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

(singke) #1

boolean copy(string source, string destination)


The copy function copies a file specified by the source argument into the file specified by
the destination argument. This results in two separate and identical files. A similar
function is link, which is described below.


<?
if(copy("data.txt", "/tmp/data.txt"))
{
print("data.txt copied to /tmp");
}
else
{
print("data.txt could not be copied");
}
?>


float diskfreespace(string path)


The diskfreespace function returns the number of free bytes for the given path.


<?
print(diskfreespace("/"));
print(" bytes free");
?>


object dir(string directory)


The dir function creates a directory object to be used as an alternative to the group of
functions that includes opendir and closedir. The returned object has two properties:
handle and path. The handle property can be used with other directory functions such as
readdir as if it were created with opendir. The path property is the string used to create
the directory object. The object has three methods: read, rewind, and close. These
behave exactly like readdir, rewinddir, and closedir.


boolean fclose(integer file_handle)


The fclose function closes an open file. When a file is opened, you are given an integer
that represents a file handle. This file handle is used to close the file when you are
finished using it. The functions used to open files are: fopen and fsockopen. To close a
pipe, use pclose.


<?

Free download pdf