How to use unset to clear variables in php?
How to destroy variables through unset() in php:
Declare a string and print it
The preview effect is as shown
unset destroys the variable and Output
The preview effect is as shown in the figure, the variables are destroyed and there is no output
Define multiple variables and print
The preview effect is as shown
Destroy multiple variables at the same time and print
The preview effect is empty
Source code is attached
<?php //php通过unset()销毁变量 $name='konhq'; unset($name); echo $name; $a=$b=$name='konhq'; unset($a,$b,$name); var_dump($a,$b,$name); ?>
Recommended: "PHP Video Tutorial"
The above is the detailed content of How to use unset to clear variables in php. For more information, please follow other related articles on the PHP Chinese website!