+ 6
Whatâs the difference between unset() and unlink() ?
6 Answers
+ 6
* unset - Destroys a variable
http://php.net/manual/en/function.unset.php
* unlink - Deletes a file
http://php.net/manual/en/function.unlink.php
Hth, cmiiw
+ 5
Thanks Sachin Artani for details.
+ 5
ThanksIpang .
+ 4
Hi,
unset() function is used to destroy a particular session variable.
eg. unset($_SESSION['success'])
unlink() function is used to remove the file from the file manager. I recently used it in a job portal, where a user when updates his CV, old CV will be replaced with new. So, to remove old one, I used unlink() function.
+ 4
Anuska You're welcome : )
+ 3
unset sets defined variable to null and unlink just deletes file
unlink(filename)
unset($variablename)