I am trying to create a function that clears a user ID session before a login is performed. You know the worst nightmare of a programmer is persistent sessions that remain open when another user logs in on the same machine. Assuming that this function will be called in a multi-user environment, can I define it as a static class function (which will have one instance only)
public static function clear()
{
unset($_SESSION['user']
}
or should it be declared as a object instance function?
public function clear()
{
unset($_SESSION['user']
}
What will happen if more than one user invoke that function e.g. Logging in simultaneously? Will the sessions on all Client machines be deleted simultaneously which will of course be a chaotic outcome?