Home / PHP Tips Generated By ChatGPT / Checking Whether a Variable is Set and Not Null in PHP Use isset() to check if a variable has been set and is not null. Source Code $var = ''; if (isset($var)) { echo "Variable is set."; }