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

How to use unset to clear variables in php

藏色散人
Release: 2023-03-01 07:14:01
Original
3581 people have browsed it

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);
?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template