Asked in
PHP Programming

How do you clear a variable in PHP?


User Avatar
Wiki User
November 29, 2008 3:02PM

You can unset a variable in PHP by setting it to NULL. You can set a variable to NULL by declaring it normally, or using the function "unset()". Both methods are acceptable, and accomplish the same thing. Examples of both: ---- $variable = NULL; ---- unset($variable); ----