First look at the unset function syntax
unset
Deletes a variable.
Syntax: int unset (mixed Var);
return value: Integer
Function type: PHP system function
Content Description
This function deletes the variable and returns a true value for
PHP uses unset () to delete a cell (key) in an array, unset array
This example describes how PHP uses unset () to delete a cell (key) in an array. Share to everyone for your reference. The specific analysis is as follows:
Unset can either delete a
In PHP, unset and array_splice are used to delete the elements in the array. The difference is unsetarray_splice. In PHP, unset and array_splice are used to delete elements in an array. if unsetarray_splice is used to delete an element in an array,
Php uses unset () to delete a cell (key) in an array. Php uses unset () to delete a cell (key) in an array. This article mainly introduces how php uses unset () to delete a cell (key) in an array, this example analyzes how the unset function deletes
In actual use, PHP unset global variables can only destroy local variables and cannot implement global variables. Next we will solve this problem in detail. Hope to help you.
Some functions in PHP are literally hard to understand for beginners. You
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 ()
After unset is used in php to delete an element, the array index is not re-created because the index is not re-created. If you continue to use the index after unset, an error is returned. In this case, you can use array_values to re-create the array
PHP Tutorial Variable Destruction unset usage
Unset--releasing the given variableDescribevoid unset (mixed var [, mixed Var [, ...]])
Unset () destroys the specified variable. Note in PHP 3, unset () returns True (actually an integer value of 1),
Unset,array_splice in PHP removes the difference between elements in an array
It is very simple to delete an array element in PHP, but sometimes deleting an array requires some ordering of the index and we will use the relevant function, here we
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.