What is the correct way to specify the path for the unlink function in PHP?

When using the unlink function in PHP to delete a file, it is important to specify the full path to the file in order for it to work correctly. This is because PHP may not always be able to resolve relative paths correctly. To ensure the correct path is used, it is best to use the __DIR__ magic constant to get the directory of the current script and then concatenate the file name to it.

$file = __DIR__ . '/path/to/file.txt';
unlink($file);