php8.5
Home/ Manual/ spl / splfileinfo/ SplFileInfo::isReadable

SplFileInfo::isReadable

PHP function Edit on GitHub ✎

(PHP 5 >= 5.1.2, PHP 7, PHP 8)

Tells if file is readable

Description

SplFileInfo::isReadable(): bool

Check if the file is readable.

Parameters Parameters

Return Values

Returns true if readable, false otherwise.

Examples

SplFileInfo::isReadable example

php
<?php
$info = new SplFileInfo('readable.jpg');
if ($info->isReadable()) {
    echo $info->getFilename() . ' is readable';
}
?>

The above example will output something similar to:

output
readable.jpg is readable

Source: reference/spl/splfileinfo/isreadable.xml · from the official PHP manual (php/doc-en)