When the variable is an empty string and a Boolean value of false and the value 0 o'clock, isset all returns True, directly judging all return false:
$empty = "; Echo (Isset ($empty)?" 1 ': 0);//1echo '
' Echo ($empty? ') 1 ': 0);//0
$empty =false;echo (Isset ($empty)? ' 1 ': 0);//1echo '
' Echo ($empty? ') 1 ': 0);//0
$empty =0;echo (Isset ($empty)? ' 1 ': 0);//1echo '
' Echo ($empty? ') 1 ': 0);//0
They are indistinguishable only when the variables are null:
$empty =null;echo (Isset ($empty)? ' 1 ': 0);//0echo '
' Echo ($empty? ') 1 ': 0);//0
Although Isset does not work in judging variables, it is useful to have a variable in the judgment array:
$arr =array (' 1 ' =>1, ' 3 ' =>3); the array in the $temp =null;//ps:php is different from map, and if you do not have a key and you go to the value will throw an error instead of returning null, so to have a corresponding judgment, first determine the value if ( Isset ($arr [' 2 '])) {//The effect is equivalent to Array_key_exists (' 2 ', $arr), but the relative code is a little shorter $temp = $arr [' 2 '];} Echo $temp;
And the isset do not know can go to the official website to see the understanding:
http://php.net/manual/zh/function.isset.php
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.