Difference between unset() and unlink()

General discussion on PHP
Post Reply
jaco8683
Posts: 1
Joined: Tue Apr 24, 2018 6:36 am

Difference between unset() and unlink()

Post by jaco8683 » Tue Apr 24, 2018 6:41 am

What’s the difference between unset() and unlink() and How can we get the IP address of the client?

shas7146
Posts: 8
Joined: Fri Sep 15, 2017 11:41 am
Contact:

Re: Difference between unset() and unlink()

Post by shas7146 » Fri May 04, 2018 12:27 pm

Unset() : It is a function that is used to remove a single variable, multiple variables, or an element from an array.

Unlink(): It is also a function that is used to delete files. If you have uploaded files a file and wants to delete this file through the coding then this function is used to delete the file.

angelarichard
Posts: 1
Joined: Sat May 19, 2018 6:26 am

Re: Difference between unset() and unlink()

Post by angelarichard » Sat May 19, 2018 6:32 am

In PHP unlink() function is used for file system management and to delete some files and unset() function is used for variable management.



------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
essay writing service reviews

paul9108
Posts: 4
Joined: Thu Feb 01, 2018 8:42 am
Contact:

Re: Difference between unset() and unlink()

Post by paul9108 » Wed May 30, 2018 11:26 am

PHP unlink() functions are used to delete a file within a directory completely on successful execution, Rather, it causes PHP warning error. The possibilities for error occurrences are, if we are not having permission to access the directory of the file to be deleted, or if such file does not exist.

Unlike the above PHP function, unset() is used to make the target file to be empty on removing its content, meaning that, the purpose is for clearing content instead of deleting a file permanently from the folder. unset() not only used to clear the file content, but also used for undoing initialization of a PHP variable, and thereby makes it empty.

--------------------------------------
Web Development Los Angeles
--------------------------------------

Post Reply