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

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


Yes.

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

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


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.