PHP special methods: set (), get (), isset (), and unset ()
The _ set () method is used to set private property values.
The _ get () method is used to obtain private property values.
The _ isset () method is used to check whether the private
In PHP array of quantum mechanics a very useful array type, let me summarize some of the various methods to delete array elements, delete the elements in the array, the first idea is to use the unset function, it can be deleted, but it may be later
The unset () function of PHP is used to clear and destroy variables. unused variables can be destroyed using unset. However, in some cases, the memory occupied by destroying variables cannot be reached with unset! Let's first look at an example:
In PHP, the difference between global and $ globals [""] originally felt that both global and $ globals had the same writing style, however, in actual use, it is found that the difference between the two is still very big!
Let's take a look at the
This may cause some problems. Some may carelessly change a global variable. Global variables in PHP must be declared as Global when used in functions (note that the Global keyword is useful in function definition ).
1: Global is used to define
An interesting question about php destructor: php Functions
With the widespread development of object-oriented programming, object-oriented programming presents many interesting problems. I believe many beginners will come into contact with two
In PHP, unset destroys variables. In php, the method for destroying variables and interpreting the memory specification is to directly use the unset () function, however, the test will find that unset only applies to all variables pointing to this
The PHP unset () function is used to clear, destroy variables, and we can destroy them with unset (). But at some point, using unset () does not achieve the memory that is consumed by destroying variables! Let's look at an example first:
Simple use of php destructor, php instructions. Simple use of php destructor, php instructions with the widespread development of object-oriented programming, object-oriented shows many interesting problems. I believe that many beginners will learn
The unset function is a built-in function for php to destroy variables. we introduced how to use unset to destroy static variables and global variables, and how to destroy array variables. let's look at the example below. example 1. the unset ()
When you have finished using a session variable, you can delete it, or you can destroy it after you have completed a conversation. If the user wants to quit the WEB system, he will need to provide him with a logout function to destroy all his
The array in PHP is actually an ordered map. A map is a type that associates values to the keys. This type is optimized in many ways, so it can be used as a real array, or as a list (vector), a hash (an implementation of a mapping), a dictionary, a
forum-20160919104018">forum-20160919104018">The array in PHP is actually an ordered map. A map is a type that associates values to the keys. This type is optimized in many ways, so it can be used as a real array, or as a list (vector), a hash (an
The second analysis of global and $ GLOBALS [] in PHP. For more information, see the previous example:
PHP code
The code is as follows:
// Example 1Function test_global (){Global $ var1, $ var2;$ Var2 = & $ var1;}Function test_globals (){$
This article mainly introduces the method of magic in object-oriented oop in PHP, which has certain reference value, and the interested partners can refer to
One, what is the Magic method:
PHP provides us with a series of functions with the
This article mainly introduces the Magic method and Magic constants in PHP, has a certain reference value, now share to everyone, the need for friends can refer to
Magic method
__construct () construction method
When instantiating an object, add
Php obtains the status of a variable.
Isset ()Isset ()-check whether the variable is setSyntax:Bool isset (mixed $ var [, mixed $ var [, $...])Note:If var exists, true is returned; otherwise, false is returned.Note:If the variable has been
Analysis 2 of global and $ GLOBALS [] in PHP. I still use the example in the previous article: Copy the code in PHP code as follows :? Php example 1functiontest_global () {global $ var1, $ var2; $ var2} functiontest_globals () {$ GLOBALS [va or
The __set () method is used to set the private property value.
The __get () method is used to get the private property value.
The __isset () method is used to detect whether a private property value is set.
The __unset () method is used
PHP Delete, empty session summary of the way, phpsession
Session Delete Clear is very fastidious if we can clear the specified variable if we are not careful to remove all the sessions, let's take a look at some summary.
The first way:unset
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.