iCoders iCoders -4 years ago 190
PHP Question

PHP unset session in method

i have created a custom class to manage all types of session

i have created few static methods but for unset its giving me an error

public static function unsetSession($para) {

return unset($_SESSION[$para]);


Can nay one give an idea why its throwing error

I read php document


void session_unset ( void )

function frees all session variables currently registered.

Return Values

No value is returned.

is it unset is not returning ?


Getting following Error

Parse error: syntax error, unexpected 'unset' (T_UNSET)

Answer Source

Have you tried this?

public static function unsetSession($para) {
    return session_unset($_SESSION[$para]);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download