Jump to content

Session won't unset


JudgementDay

Recommended Posts

I have one entity:

$_SESSION['order']['content']['lol']

 

I then unset this entity:

unset($_SESSION['order']['content']['lol']);

 

I then try to unset the following as it is now empty (because I removed "lol"), buts its not working:

if (empty($_SESSION['order']['content'])) {
unset($_SESSION['order']['content']);
}

 

Does anyone know why and how I can go about getting it to unset?

Link to comment
https://forums.phpfreaks.com/topic/256259-session-wont-unset/
Share on other sites

why would you assume that $_SESSION['order']['content'] is empty? was "lol" the only key/value in the array?

 

have you tried print_r()ing or var_dump()ing the array to make sure that it is truly empty?

 

The problem is not with unset(), the problem is that your condition is not returning true.

Link to comment
https://forums.phpfreaks.com/topic/256259-session-wont-unset/#findComment-1313686
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.