How To Remove Values Saved in the Current Session

Q

How To Remove Values Saved in the Current Session? - PHP Script Tips - Understanding and Using Sessions

✍: FYIcenter.com

A

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.

2007-04-17, 4853👍, 0💬