I'm having trouble resetting session variables in PHP. I'm now trying just testing resetting the session variable like this, but this doesn't even work:
session_start();
$_SESSION["name"] =false;
if (!isset($_SESSION["name"])) {
$message = getname(); //can't get this to ever be called
} else {
$message = welcome();
}
What am I missing here?
You want to unset the session variable
unset($_SESSION['name']);
Setting it to false makes it so it's still set (so isset will still return true), the only difference is that the actual value of the variable has changed to false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With