Determining whether a variable is empty can also be understood as judging whether the variable is false. Returns a Boolean value of true or false.
In addition to not generating a warning when the variable has no value, empty($var) is the antonym of (bool)$var.
If $var can be converted to boolean false, the return value of empty() is true, otherwise, it returns false.
The following seven values, when converted to boolean (same as bool), are considered false:
are treated as true.
var_dump( (bool)false );
var_dump( (bool)0 );
var_dump( (bool)0.0 );
var_dump( (bool)'0' );
var_dump( (bool)'' );
var_dump( (bool)array() );
var_dump( (bool)null );
?>
empty returns true in seven cases of false , the rest return false.
bool isset(mixed$var[, mixed$...] )Determine whether the variable is set. If the value of a variable is not null, it means that the variable is set, and true is returned; otherwise, false is returned.
A variable is considered null in the following situations:
isset() Three types of NULL Returns false in this case, and returns true in all other cases.
The above has introduced the difference between empty and isset, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.