Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

is_readable

Description

Tells whether a file exists and is readable

Syntax

is_readable ( string $filename ) : bool

Parameters

filename

Path to the file.

Return

Returns TRUE if the file or directory specified by filename exists and is readable, FALSE otherwise.

Examples

1

<?

function read($filename)
{
    if (is_readable($filename)) {
        echo "readable\n";
    } else {
        echo "not readable\n";
    }
}

read($_SERVER['DOCUMENT_ROOT'] . '/assets/txt/file.txt');
read('false.txt');

?>
readable
not readable
HomeMenu