php is_readable() function - how to check whether specific file is readable

php is_readable() function - how to check whether specific file is readable


is_readableFunction.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>php is_readable() function - how to check whether specific file is readable</title>
</head>

<body>
    <h2 style="color:OrangeRed; font-style:italic">
     php is_readable() function example:<br /> how to check whether specific file is readable
    </h2>
    <hr width="500" align="left" color="Orange" />
    <br />

<?php
 $file = "test.txt";
 echo "<font style=color:Green;font-weight:bold;font-size:large;>";
 
 if(is_readable($file))
 {
  echo "test.txt is readble";
  }
 else
 {
  echo "test.txt is not readble";
  }
 echo "</font>";
?>
</body>
</html>