if empty php echo or else Function

Last Updated : 25-09-2022

$a = 0;
if (empty($a)) { echo “Variable a is empty”; } else {  echo “Variable is not empty”; }

// True because $a is set
if (isset($a)) {
  echo “Variable ‘a’ is set”;
}

also you can use

if (isset($a)) {
echo “Variable ‘a’ is set.”;
}

if ($user_id == NULL || $user_name == NULL || $user_logged == NULL) {
    $user_id = '-1';
    $user_name = NULL;
    $user_logged = NULL;
}
if ($user_admin == NULL) {
    $user_admin = NULL;
}