Home  >  Article  >  Backend Development  >  How to use unset to clear variables in php

How to use unset to clear variables in php

藏色散人
藏色散人Original
2020-05-10 13:36:253395browse

How to use unset to clear variables in php

How to use unset to clear variables in php?

How to destroy variables through unset() in php:

Declare a string and print it

How to use unset to clear variables in php

The preview effect is as shown

How to use unset to clear variables in php

unset destroys the variable and Output

How to use unset to clear variables in php

The preview effect is as shown in the figure, the variables are destroyed and there is no output

How to use unset to clear variables in php

Define multiple variables and print

How to use unset to clear variables in php

The preview effect is as shown

How to use unset to clear variables in php

Destroy multiple variables at the same time and print

How to use unset to clear variables in php

The preview effect is empty

Source code is attached

<?php
//php通过unset()销毁变量
$name=&#39;konhq&#39;;
unset($name);
echo $name;
$a=$b=$name=&#39;konhq&#39;;
unset($a,$b,$name);
var_dump($a,$b,$name);
?>

How to use unset to clear variables in php

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn