Checking File Existence in PHP

The function file_exists checks whether a file, whose path is passed as a parameter, exists. Example:

phpvar_dump(file_exists('test.txt')); // true or false

Typically, this function is used to check for a file's presence before performing an operation on it. For example, like this:

php<?php
  if (file_exists('test.txt')) {
    echo filesize('test.txt');
  } else {
    echo 'file does not exist';
  }
?>
Задание 1

Check if the file file.txt is located in the root of your site.

Задание 2

Check if the file file.txt is located in the root of your site. If not - create it and write the text '!' into it.

Задание 3

Check if the file message.txt is located in the root of your site. If such a file exists - output the text of this file to the screen.