How to declare or remove a variable in PHP?
A new variable can be brought into use by assigning a value. A variable therefore doesn’t need to be declared or defined from the start. On the other hand a variable therefore also doesn’t need to be removed or destroyed. As soon as a PHP script is completely executed all script variables will be automatically removed. If for some reason a variable still needs to be removed at an earlier stage this can of course also be realized. To remove a variable you make use of the language construction unset(). In order to maintain a variable but to check at the same time if a variable already exists, you should make use of the language construction isset(). We would also recommend to execute empty() after having executed isset(). By means of empty() it will be determined if a variable is empty or not.