JasonDavis JasonDavis - 1 month ago 5
PHP Question

Can you unset() many variables at once in PHP?

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);

?>

Answer

Yes.

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

void unset ( mixed $var [, mixed $var [, mixed $... ]] )