Home > PHP > Function > Filesystem > file_exists()

file_exists()

file_exists - Checks whether a file or directory exists

Syntax

bool file_exists (string $filename)

Arguments

  • filename - Path to the file or directory. On windows, use //computername/share/filenameor \\computername\share\filenameto check files on network shares.

Description

Checks whether a file or directory exists.

Version

PHP 4, 5

Return value

Returns TRUE if the file or directory specified by filename exists; FALSE otherwise.