php file_exists() function - how to check whether a file exists or not in php

php file_exists() function - how to check whether a file exists or not in php


file_existsFunction.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 file_exists() function - how to check whether a file exists or not in php</title>
</head>

<body>
    <h2 style="color:DarkOrange; font-style:italic">php file_exists() function example:<br /> how to check whether a file exists or not</h2>
    <hr width="375" align="left" color="Orange" />
    <br />

<?php

 $file = "employee.csv";
 $file2 = "employee.txt";
 echo "file exists? (employee.csv) :";
 echo file_exists($file);
 echo "<br />";
 echo "file exists? (employee.txt) :";
 echo  file_exists($file2);
?>
</body>
</html>