session_name

string session_name(string session_name) 

Retrieves or sets the session name.

Returns:

Current session name

Description:

Retrieves or sets the current session name. The name of the session defaults to PHPSESSID; this default value can be altered in the PHP initialization file.

Version:

Existing since version 4.0

Example:

Show session name
session_start(); 
echo "Session name is ", session_name(); 
session_name("MY_SESSION"); 
echo "Session name is ", session_name(); 

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.