Let's talk about what they have in common:
Can determine whether a variable is empty;
Returns a Boolean type, which is either true or false.
Here's a specific distinction between their usage:
Isset () is used to detect if
PHP's Isset () function is commonly used to detect whether a variable is setFormat: bool Isset (mixed var [, mixed Var [, ...])Function: Detect whether the variable is setreturn value:Returns FALSE if the variable does not existReturns FALSE if the
BOOL Isset (mixed Var); [; mixed var[,...]]This function requires a variable name as a parameter and returns TRUE if the variable exists, otherwise false.You can also pass a list of variables separated by commas, and if all variables are set, the
This should be done with if (Isset ($_post[' submit ')) {
}
difference between if ($_post[submit]) and if (Isset ($_post[submit)) when submitting a form
The first method will show a warning, the second is relatively more rigorous.
There is also
The variable passed to the Isset returns False if it is assigned null after the declaration or declaration
$num 2 = 100;
$num 3 = null;
$num 4 = "";
Var_dump (Isset ($num 1));//false
echo "";
Var_dump (Isset ($num 2));//true
echo "";
Var_dump (Isset
: This article mainly introduces the differences between empty and isset. For more information about PHP tutorials, see. Bool empty (mixed $ var)
To determine whether a variable is null, you can also determine whether the variable is false. Returns
Isset ($var); is false no definition is not defined as false
$var = ";
Isset ($var); For true defines the true
Empty ($var); True value is null back to True
$var = ' 111 ';
Empty ($var); False is not NULL to return False
zhanhailiang 日期:2014-10-08
今天遇到一个很奇怪的bug,测试如下:
查了下手册说明:
Example #2 isset() on String Offsets PHP 5.4 changes how isset() behaves when passed string offsets. Output of the above example in PHP 5.3: bool(true)bool(true)bool(true)bool(true)bool(true)
Solution to empty and isset-does PHP variable define a warning when accessing an undefined variable? Before use, you can use empty (); or isset () to determine whether the variable defines $ arr ['k1 ']. although $ arr is undefined, we can still use
In PHP, empty, isset, and is_null are different. if the variable is not null or a non-zero value, empty () returns FALSE. In other words, "", 0, "0", NULL, FALSE, array (), var $ var, undefined; and no difference between empty, isset, and is_null in
For PHP, emptyisset is used to determine the parameter values of empty and isset. For PHP, how does emptyisset determine the parameters of empty and isset? Phpclasstest {}$ a1null; $ a2; $ a3 $ a40; $ a50; $ a6false; $ a7array (); var $ a8; $
The difference between empty and isset, Emptyisset difference
These two functions have not been very understanding, write a small program to deepen understanding!
PHP/* * Isset-detects if the variable is set * returns TRUE if the variable
Can an http post request sent by the client socket trigger the isset of the PHP page on the server? I use a SOCKET on the client to send an HTTP POST request POST/send. PHP/1.1 Host: www. temp. comUser-Agent: Mozilla/5.0 (can an http POST request
PHP's Isset () function is commonly used to detect whether a variable is setFormat: bool Isset (mixed var [, mixed Var [, ...])Function: Detect whether the variable is setreturn value:Returns FALSE if the variable does not existReturns FALSE if the
Question 1: Does the following empty array use Isset ($arr [0][' id ']) to determine whether there are notice errors?
Question 2: Does the following empty array use empty ($arr [0][' id ']) to determine whether there are notice errors?
$arr =
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
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.