tags:

views:

121

answers:

3

I have a pretty high traffic social network site,
I would like to get into the habit of unsetting large array and mysql object and even some string variables.

So is it possible to unset more then 1 item in PHP

example:

<?PHP

unset($var1);

// could be like

unset($var1,$var2,$var3);

?>
+5  A: 

Yes.

Your example will work just as you imagine. The method signature for unset() is as follows:

void unset ( mixed $var [, mixed $var [, mixed $... ]] )
jason
I think I liked my answer better when it was just 'Yes.'
jason
Yes I actually did look there, I must of overlooked this part though
jasondavis
+1 for beating me to the first answer
Jefe
+2  A: 

Yes, see the PHP manual, Example 1:

http://us2.php.net/manual/en/function.unset.php

Jefe
+6  A: 

The PHP manual can be very handy. You can search for any built-in function and get a pretty detailed description of what that function does, etc. And the answer is yes, you can supply unset with as many variables as you want.

Mark Rushakoff
+1 for explaining the manual :)
Jefe
Jefe, +1 for being awesome.
jason
@jason thanks even though you're the amazing one, by answering first :)
Jefe