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

file_exists()

Example

Determine if a file exists.

<?php
echo file_exists(“webdictionary.txt”);

 ?>

Definition and Usage

The file_exists() function checks if a file or directory exists.

 

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

Syntax

file_exists(path)

Parameter Values

 

Parameter

Description

path

Mandatory. Specifies the path to the file or directory to check.

Technical Details

Return Value:

Returns TRUE if the file or directory exists, or FALSE if it does not.

PHP Version:

4.0+