-
-
/** - * isset — Check whether a variable is set
- * Return true if the variable exists, false otherwise
- *
- * empty — Check whether a variable is empty
- * If the variable is a non-empty or non-zero value, empty() returns false
- **/
$is_var = '';
if (isset($is_var)) {
- echo "The variable exists!
";
- } else {
- echo "The variable does not exist!
";
- }
- < ;p>if(empty($is_var)) {
- echo "The variable is empty!
";
- } else {
- echo "The variable is not empty!
";
- }
- ?>
-
Copy the code
Output results:
The variable exists!
The variable is empty!
|