PHP is_readable()Functions
Complete PHP Filesystem Reference Manual
Definition and Usage
The is_readable() function checks whether the specified file is readable.
If the file is readable, this function returns TRUE.
Syntax
is_readable(file)
| Parameters | Description |
|---|---|
| file | Required. Specifies the file to be checked. |
Tips and Notes
Note:The results of this function are cached. Use clearstatcache() to clear the cache.
Examples
<?php
$file = "test.txt";
if(is_readable($file))
{
echo ("$file is readable");
}
else
{
echo ("$file is not readable");
}
?>
$file = "test.txt";
if(is_readable($file))
{
echo ("$file is readable");
}
else
{
echo ("$file is not readable");
}
?>
The code above will output:
test.txt is readable
Complete PHP Filesystem Reference Manual Other Extensions