PHP is_readable() Function

PHP is_readable Function


Definition :

The PHP is_readable() function checks whether a file exists and is readable.

Note: The results of this function are cached. Use clearstatcache() function to clear the cache.

Syntax

  is_readable(file)

Parameter
Parameter Description
file Required. Specifies the path to the file to check

Example:

Lets assume that we have a file called demo.txt in the current working directory. The example below demonstrates on using this function to check whether a file exists and is readable.

Output :demo.txt is readable