session_destroy

int session_destroy(void) 

Ends session.

Returns:

TRUE on success; FALSE on failure

Description:

Ends a session and removes any session data associated with that session.

Version:

Existing since version 4.0

Example:

Destroy a session
session_start(); 
if (!$counter) session_register("counter"); 
$file = session_save_path()."/sess_".session_id(); 
readfile($file); 
session_destroy(); 
// this will cause an error to show session info gone 
readfile($file); 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.