Possible Duplicate:
Can you unset() many variables at once in PHP?
$var1 = $var2 = $tvar3 = null;
Is it okay to remove variables like this?
Are there better ways to unset couple of variables?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
unset()is variadic (i.e. it takes any number of arguments and unsets them all):Also note that
unset()is not the same as setting toNULL. Usingunset()you actually remove the variables, whereas setting them toNULLkeeps them defined, just with a “value” ofNULL. Doing it either way causesisset()to return false on those variables, but they’re still semantically and technically different.Here’s a quick proof: