What is the difference between the functions UNLINK and UNSET?

Unlink
It is used to delete the file used in the context.

Example :
unlink('test.html');

Unset
It is used to unset or destroy the variable.

Example :
unset($var);

If a global variable is attempted to "unset" inside a function, the local variable is destroyed.
 
unlink is a function for file system handling, unlink is used to delete files. unset is a function for variable management. It will make a variable undefined. Unset is used to destroy a variable in PHP.
 
In PHP unlink() is a function for file system handling, unlink() is used to delete files (physical).

And unset() is a function for variable management. It will make a variable undefined. Unset () is used to destroy a variable in PHP. In can be used to remove a single variable, multiple variables, or an element from an array.
 
Back
Top