The unset function is a function that comes with PHP to destroy variables. We introduced the method of using unset to destroy static variables and global variables. At the same time, we also introduced the method of destroying array variables. Let's see an example below.
Example 1. unset() example
The code is as follows | Copy code | ||||||||||||||||||||||||||||||||||||
//Destroy a single array element
// Destroy more than one variable unset ($foo1, $foo2, $foo3); ?>The behavior of unset() in a function will vary depending on the type of variable you want to destroy.
If you unset() a global variable in a function, only the local variable will be destroyed, and the variables in the calling environment will maintain the same value before calling unset().
Previous article:Modify PHP session default time method_PHP tutorial
Next article:PHP Find Array Value Program_PHP Tutorial
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
Latest Articles by Author
Latest Issues
Group MySQL results by ID for looping over
I have a table with flight data in mysql. I'm writing a php code that will group and displ...
From 2024-04-06 17:27:56
0
1
406
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
|