is_readable() function checks the readability of both a file and a directory.
Its syntax is: bool is_readable (string filename)
<?
$filename="data.txt";
if ( is_readable($filename) ) :
$fh = fopen($filename, "r");
else :
print "$filename Is not readable!";
endif;
?>
Related examples in the same category