Curriculum
Course: PHP Basic
Login

Curriculum

PHP Basic

PHP Install

0/1

PHP Casting

0/1

PHP Constants

0/1

PHP Magic Constants

0/1

PHP Operators

0/1

PHP Reference

0/276
Text lesson

is_readable()

Example

Verify if the given filename can be read by checking:

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

The code above might produce is:

test.txt is readable

Definition and Usage

The is_readable() method determines if the given filename can be read.

Note: This function caches its output. To clear the cache, use clearstatcache().

Syntax

is_readable(file)

Parameter Values

Parameter

Description

file

Essential. gives the location of the file to be checked.

Technical Details

 

Return Value:

If the file is readable, TRUE; if not, FALSE and an E_WARNING are displayed.

PHP Version:

4.0+