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

(singke) #1

?>


boolean touch(string filename, integer time)


The touch function attempts to set the time the file was last modified to thegiven time,
expressed in seconds since January 1, 1970. If the time argument is omitted, the current
time is used. If the file does not exist, it willbe created with zero length. This function is
often used to create empty files.


To find out when a file was last modified, use filemtime.


<?
touch("data.txt");
?>


integer umask(integer umask)


The umask function returns the default permissions given files when they are created. If
the optional umask argument is given, it sets the umask to a logical-and (&) performed on
the given integer and 0777. Under Windows this function does nothing and returns
false. To find out the permissions set on a particular file, use fileperms.


<?
printf("umask is %o", umask(0444));
?>


boolean unlink(string filename)


The unlink function removes a file permanently. To remove a directory, use rmdir.


<?
if(unlink("data2.txt"))
{
print("data2.txt deleted");
}
else
{
print("data2.txt could not be deleted");
}
?>

Free download pdf