Learning PHP and MySQL

Example 11-20 The file_exists.php script checks to see if the file is there

<?php
   $file_name
="file_exists.php";

    if(
file_exists($file_name))  {
      
echo  ("$file_name  does  exist.");
    
}
    
else  {
       
echo  ("$file_name  does  not  exist.");
    
}
?>

As you would expect, the file does exist, the output is:

The file exists.php does exist.

Posted by on 08/19 at 08:27 AM

Next entry: Example 11-21 Checking the permissions of a file

Previous entry: Example 11-19 Creating a timestamp from the components of a date

<< Back to main