This should result in $_SESSION[‘buy_amount’] as not being set! Right?
But when I test for it to be !isset it is saying that it is SET!
I mean of course:
if (isset($_SESSION[‘buy_amount’])) {
echo ‘<p>buy_amount_session ISSET’;
}
What the HEK is going on?
Why is this $_SESSION[‘buy_amount’] after being set to NULL still saying that it isset?
Actually in subsequent test $_SESSION[‘buy_amount’] = NULL is leading to
if (isset($_SESSION[‘buy_amount’])) is NOT being true, as it should be.
SO I have no idea why earlier this basic test was failing! I think I need to take a brake
But it is good to get the tip from you about unset($_SESSION[‘buy_amount’]).
However, unset($_SESSION[‘buy_amount’]) should be same as $_SESSION[‘buy_amount’] = NULL
Ah, sorry, I miss read your question and confused myself. So in your case, setting it to NULL you expecting isset($_SESSION[‘buy_amount’]) to return false. However, it is returning true… time to run some tests, as I’m intrigued now
As far as isset() is concerned, yes. Any other way, no. As the array key would still be part of $_SESSION using = null, but that wouldn’t be the case using unset.