PHP DESTROY OR UNSET SESSION - PHP LESSON 21 STUDENTSBLOG100

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 variables
PHP 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"

PHP SESSION UNSET PROGRAM:

OUTPUT:
If the session was cleared, then the output will be "Session cleared successfully" else "Session was not cleared"

Lesson 20  Previous | Main Page | Next Lesson 22

Previous
Next Post »