Is_null, empty, isset, unset Let's take a look at the descriptions of these 4 functions first.
Isset determine if a variable already exists (configuration)unset to remove (release) a variableEmpty determine if the variable is emptyIs_null determine
This article illustrates the difference between isset and array_key_exists in PHP. Share to everyone for your reference. The specific analysis is as follows:
1. For the judgment of the array value, return true for the value of NULL or ' or
ISSET (); -- this parameter is suitable for detecting whether this parameter exists.
Definition and scope of action: used to test whether a variable has a value (including 0, FALSE, or an empty string, but cannot be NULL), that is, "http: //
This problem arises when using isset to detect whether a value exists for a sessionTranslation: You cannot use the return value of a function in a filled-in content. Then I looked at the PHP manual to see the use of the Isset function : isset () can
When using php to write page programs, I often use the variable processing function to determine whether the variable value of a parameter at the end of the php page is null. At the beginning, I used to use the empty () function, but some problems
Is_null, empty, isset, and unset. Let's take a look at the descriptions of these four functions.
Isset determines whether a variable already exists (configuration)Unset: delete (release) the variable.Empty determines whether the variable is
ISSET ();--suitable for detecting the existence of this parameter.
Definition and scope: used to test whether a variable has a value (including 0,false, or an empty string, but not null), that is, "http://localhost/?fo=" can also be detected and
Differences between isset and array_key_exists in PHP functions. The isset and array_key_exists methods are generally used to determine whether the index value of a PHP array exists. Isset ($ a [key]) array_key_exists (key, $ a) array_key_exists is
Analyze how empty and isset functions are implemented in the PHP kernel.
#### I mentioned this question on oschina:
但一直没收到合适的答案,所以还是自己下功夫梳理了一下,如果有错误的地方,欢迎交流。通常的函数是通过zend_function(xxx) 这种宏定义来实现的,这个规范很好理解,也很容易读懂源码。但empty(), isset()
Questions about isset in php if (isset ($ _ POST ['pass']) & isset ($ _ POST ['name']) & @ MD5 ($ _ POST ['pass']) = "admin" & @ $ _ POST ['name'] = "admin ")
Why can't I enter the user name admin and password admin at the front end?
If
Empty () function: mainly determines whether the variable is not empty or not 0. If the variable value is not null or not 0, true is returned; otherwise, false is returned.
Differences between empty () and isset () functions:
Empty () function:
Empty seems to be different from isset? Look at the following code
Show information for all users (table)
Querying data
$conn =mysql_connect ("localhost", "root", "5200") or Die (Mysql_error ());
Set the encoding for MySQL
mysql_query
if (Isset ($_post["Pagelimit") &&!empty ($_post["Pagelimit"]) {
$pageLimit =$_post["Pagelimit"];
}else{
$pageLimit = 0;
}
The isset in front is not superfluous,
Some say
When there is no pagelimit field, you can throw an exception directly with
Phpin_array, trim, isset, unset, is_numeric function usage. Php in_array, trim, isset, unset, is_numeric function usage.
Script ec (2); script
Next, let's take a look at the tutorials on using these functions.
In_array ($ array)
This
The following sample code is used to explain:
1. When loading the page for the first time, because the form is not submitted, $ _ post is an empty array. At this time, $ _ post ['name'] is null, that is, the variable $ name has not been set,
Isset
How to use ISSET (), empty (), is_numeric ()Empty (); -- the best function.Definition and scope of action: used to check whether a variable has a null value, including: null string, 0, null, or false, that is, "http: // localhost /? Fo = "or" http: /
PHP has many similar functions, but there are slight differences...
Is_null, empty, isset, and unset. Let's take a look at the descriptions of these four functions.
Isset determines whether a variable already exists (configuration)Unset: delete
Analysis of differences between isset and array_key_exists in PHP,
This article describes the differences between isset and array_key_exists in PHP. Share it with you for your reference. The specific analysis is as follows:
1. the array values are
About getting the URL of the current script in PHP many friends will say it is very simple, but to get a very detailed will have to go through a lot of judgment oh.$PHP _time = time ();$PHP _self = isset ($_server[' php_self ')? $_server[' php_self '
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.