How does the inclusion of the directory path affect the functionality of the is_file function in PHP?

When using the `is_file` function in PHP, including the directory path in the file name may cause the function to return false even if the file exists. This is because the function expects only the file name without the directory path. To solve this issue, you can use the `realpath` function to get the absolute path of the file, and then pass only the file name to the `is_file` function.

$file_path = '/path/to/directory/file.txt';
$file_name = basename($file_path);
$absolute_path = realpath($file_path);

if(is_file($absolute_path)) {
    echo "File exists";
} else {
    echo "File does not exist";
}