Does session_unset unregister $ _SESSION vars?

session_unset () unregister all $ _SESSION vars or do you need to manually clear each variable registered in the $ _SESSION array using unset () ?

I got confused about this because the PHP documentation says:

Use only session_unset () for old legacy code that doesn't use $ _SESSION.

If $ _SESSION is used, use unset () to unregister the session variable

+3
source share
1 answer

Yes, it deletes all vars sessions.

session_unset - free the entire session. Variables

www.php.net

, :

session_destroy();

session_unset session_destroy. $_SESSION.

session_unset();
session_destroy();
$_SESSION = array();
+5

Source: https://habr.com/ru/post/1729670/


All Articles