Name

clearsession — clears a single session variable, or all session variables

Synopsis

void clearsession( sessionvar);  
string   sessionvar ;

Description

If called with the optional parameter sessionvar then the session variable with the name given by sessionvar is removed from the session. If there is no session variable with that name then the function has no effect.

If called without parameters then all session variables are removed.

Example 32. clearsession Example

// Get rid of all session variables prefixed with "history-"
string[] keys = sessionkeys();
for(int i = 0; i < keys.length(); i++)
    if(strlen(keys[i]) >= 8 && substr(keys[i], 0, 8) == "history-")
        clearsession(keys[i]);

See Also

Session variables and their use are explained in the section called “Session Management”.