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

(singke) #1

The is_file function returns true if the given filename is neither a directory nor a
symbolic link; otherwise it returns false. Similar functions are is_dir and is_link.


@CPO # above:?
$filename = "data.txt";


if(is_file($filename))
{
print("$filename is a file");
}
else
{
print("$filename is not a file");
}
?>


boolean is_link(string filename)


The is_link function returns true if the given filename is a symbolic link; otherwise it
returns false. Similar functions are is_dir and is_file.


<?
$filename = "data.txt";


if(is_link($filename))
{
print("$filename is a link");
}
else
{
print("$filename is not a link");
}
?>


boolean is_readable(string filename)


The is_readable function returns true if a file exists and is readable; otherwise it
returns false. On UNIX this is determined by the file's permissions. On Windows, true
is always returned if the file exists. This function is similar to is_executable and
is_writeable.


<?
$filename = "data.txt";


if(is_readable($filename))
{

Free download pdf