session_module_name()
session_module_name() — Get and/or set the current session module.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
session_module_name() gets the name of the current session module, which is also known as session.save_handler.
Signature
session_module_name(?string $module = null): string|false
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $module | ?string | If module is specified and not null, that module will be used instead. Passing "user" to this parameter is forbidden. Instead session_set_save_handler() has to be called to set a user defined session handler. |
Return value
Returns the name of the current session module, or false on failure.
Example
The PHP manual ships no example for session_module_name(); the signature and the parameter table above are the contract.
Changelog
| Version | Change |
|---|---|
| 8.0.0 | module is nullable now. |
| 7.2.0 | It is now explicitly forbidden to set the module name to "user". Formerly, this has been silently ignored. |
All PHP 8.5 built-in functions
Reference card built from the PHP manual page session_module_name() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.