Session name

suggest change

Checking if session cookies have been created

Session name is the name of the cookie used to store sessions. You can use this to detect if cookies for a session have been created for the user:

if(isset($_COOKIE[session_name()])) {
    session_start();
}

Note that this method is generally not useful unless you really don’t want to create cookies unnecessarily.

Changing session name

You can update the session name by calling session_name().

//Set the session name
session_name('newname');
//Start the session
session_start();

If no argument is provided into session_name() then the current session name is returned.

It should contain only alphanumeric characters; it should be short and descriptive (i.e. for users with enabled cookie warnings). The session name can’t consist of digits only, at least one letter must be present. Otherwise a new session id is generated every time.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Sessions:
* Session name

Table Of Contents
2 Arrays
4 Types
9 Sessions
10 Cookies
14 JSON
15 SOAP
17 cURL
19 XML
21 Traits
35 UTF-8
36 URLs
38 PHPDoc
41 Loops
44 Closur
72 YAML
77 Cache
78 Streams
81 PDO
82 SQLite3
83 Sockets
87 MongoDB
93 IMAP
94 Redis
95 Imagick
102 APCu
108 PSR