There are two methods to clear php session variables. Mostly programmers use session_unset() method to clear session data.
PHP SESSION UNSET SYNTAX:
session_unset(); - Frees all session variablesPHP SESSION DESTROY SYNTAX:
session_destroy(); - Destroys all data registered to a session
We suggest you to use session_unset method to unset all session variables.
Have doubt in session creation refer our previous tutorial "How to create PHP sessions"
Have doubt in session creation refer our previous tutorial "How to create PHP sessions"
PHP SESSION UNSET PROGRAM:
OUTPUT:
If the session was cleared, then the output will be "Session cleared successfully" else "Session was not cleared"
No comments:
Post a Comment