How can the file path be properly specified when using unlink() to delete a file in PHP?

When using unlink() to delete a file in PHP, the file path must be properly specified to ensure the correct file is deleted. The file path should be relative to the directory where the PHP script is located or an absolute path. It is important to double-check the file path to avoid accidentally deleting the wrong file.

$file_path = '/path/to/file.txt';
if (file_exists($file_path)) {
    unlink($file_path);
    echo 'File deleted successfully.';
} else {
    echo 'File not found.';
}