Deleting Files Dynamically PHP?

Cathy V

New member
I'm trying to delete a file located on my site's directory at mysite/test.php using unlink()

1. If I write unlink('test.php'), everything works perfectly.
2. If I use a variable for the file like
$a='test.php';
unlink($a) or unlink('$a') or unlink('<? echo $a?>') or unlink('".$a."'),
it's returning an error message.

Can you please give me a hint how I can use a variable instead of a string with the function?

Many thanks.
 
Back
Top