Removing Values Saved in the Session in PHP


How To Remove Values Saved in the Current Session in PHP?



If you want to remove values saved in the current session, you should use the unset() function on those saved values in $_SESSION, or use array() to empty $_SESSION:

  • unset($_SESSION['MyColor']) - Removes one value named MyColor in the current session.
  • $_SESSION = array() - Removes all values in the current session.
  • unset($_SESSION) - Bad statement. It may affect the session mechanism.


Determining If a Session Is New in PHP

Setting session.gc_divisor Properly in PHP

Understanding and Using Sessions in PHP

⇑⇑ PHP Tutorials

2016-10-24, 1495🔥, 0💬