PHP is_readable() Function

Definition and Usage

The is_readable() function determines whether the specified filename is readable.

Syntax

is_readable(file)
Parameter Description
file Required. Specifies the file to be checked.

Description

if by file Returns TRUE if the specified file or directory exists and is readable.

Tips and Comments

Note:The result of this function will be cached. Please use clearstatcache() to clear the cache.

Example

<?php
$file = "test.txt";
if(is_readable($file))
  {
  echo ("$file is readable");
  }
else
  {
  echo ("$file is not readable");
  }
?>

Output:

test.txt is readable