We are learning
The PHP unset () function is used to destroy variables, but most of the time, the function only destroys the variable, and the value of the variable stored in the memory is still not destroyed, that is, it does not achieve the
Use the unset () function in PHP to delete the array and then recreate the index. There are many ways to delete an array element in php, but the common method is to use the unset function. but how can we reconstruct the array index after deleting
There are a number of ways to remove an array element in PHP, but it is common to use the unset function, but to delete the middle array element, we will rebuild the array index, as the following reference.
The code is as follows
The actual effect of PHP's unset () functionIt's highly recommended that you share this technical article
PHP variable to memory overhead and release, whether Unset () really frees memory. Turn from: The actual effect of PHP's unset () function
The
The unset function is a function of PHP's own destruction variables, we introduced the use of unset to destroy the static variables and global variables, and can destroy the array variable Oh, let's look at the example below.
Example 1. Unset ()
I don't know why I can't show it properly.It's not the same as PHP from beginner to Proficient (3rd edition) 34 page run result 3.5.
What is this about?
Reply content:
I don't know why I can't show it properly.It's not the same as PHP from
PHP isset () and unset function usage and difference is very obvious, isset is to determine whether the variable is in existence, and unset is the elimination of variables, let's take a look at implementation.
$a = 1;echo isset ($a)? ' China Web
Application of four methods: _ set () _ get () _ isset () _ unset ()In general, the class attribute is always defined as private, which is more in line with the actual logic. However, attributes are read and assigned frequently. Therefore, in PHP5,
This article is mainly for PHP isset () and unset () functions of the use of a detailed introduction, the need for friends can come to the reference, I hope to be helpful to everyone
Isset(PHP 3, PHP 4, PHP 5)
Isset--Detect if the variable is
$var = ";
The result is true, so the text behind will be printed.
if (Isset ($var)) {
Print "This var was set set so I'll print.";
}
In the example below, we will use Var_dump to output the return value of Isset ().
The value passed by unset is a copy of an object or value (such as passing an array, passing a new copy, not a reference), and the original object is destroyed. It's so weird.
The great God is quick to answer this question. I used to use unset, and
We strongly recommend that you share this technical article if you are okay.Whether or not the memory is actually released by the unset. Convert from: the actual effect of the PHP unset () functionThe test code is as follows:Copy the PHP content to
This article brief introduction about PHP5 object-oriented detailed-(ten) __set () __get () __isset () __unset () Four methods, there is a need to send a friend can refer to the solution.
Application of four methods of __set () __get () __isset () __
This article briefly introduces four methods for PHP5 object-oriented explanation-(10) _ set () _ get () _ isset () _ unset, if you have any questions, please refer to them.
Application of four methods: _ set () _ get () _ isset () _ unset ()In
PHP5 object-oriented explanation-(10) _ set () _ get () _ isset () _ unset () four methods. This article briefly introduces four methods for PHP5 object-oriented explanation-(10) _ set () _ get () _ isset () _ unset, if you have any questions,
PHP is called the Magic Method (Magic methods), which starts with two underscores, and these methods play an important role in PHP. Magic methods include:
__construct (), constructor for class__destruct (), Destructor of class__call () Called when
10. _ set () _ get () _ isset () _ unset () application of four methods In general, the class attribute is always defined as private, which is more in line with the actual logic. However, read the attributeAnd value assignment operations are very
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.