What is the difference between the functions unlink and unset?

Unlink: Unlink() function is used to delete files from the server
Ex.

unlink('/serer_path/file.html');

unset: unset() function is used to delete or remove variable
Ex.

unset($firstname);   // remove variable $firstname


unset($_SESSION['user_id']);   // remove session variable $_SESSION['user_id']

Leave a Comment