This example of file_exists() function in PHP that checks the existence of a file or directory.
This example of file_exists() function in PHP that checks the existence of a file or directory.
The file_exists() function returns TRUE if the file or directory specified by filename exists; FALSE otherwise.
Syntax of file_exists() Function PHP
bool file_exists (file_name )
It test the existence of the file or the directory given as argument name
It return true if the file or the directory given is existing
If Not existing then it returns FALSE
Code for file_exists() Function PHP
<?php
echo "file is existing ".file_exists("c:/rose1/ram.txt");
echo "<br>file is existing ".file_exists("c:/rose1/ram1.txt");
?>