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

(singke) #1

You may also specify files by URL by starting them with http:// or ftp://. PHP will
fetch the file via the stated protocol and execute it as if it were in the local filesystem.


Use of this function is discussed in detail in Chapter 7. Compare this function to
require.


boolean is_dir(string filename)


The is_dir function returns TRUE if the given filename is a directory; otherwise it returns
FALSE. Similar functions are is_file and is_link.


<?
$filename = "data.txt";


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


boolean is_executable(string filename)


The is_executable function returns true if a file exists and is executable; otherwise it
returns false. On UNIX this is determined by the file's permissions. On Windows this is
determined by the file extension. Two related functions are is_readable and
is_writeable.


<?
$filename = "data.txt";


if(is_executable($filename))
{
print("$filename is executable");
}
else
{
print("$filename is executable");
}
?>


boolean is_file(string filename)

Free download pdf