Since HTTP is a stateless protocol, PHP has built-in support for sessions to maintain state between multiple requests. A new session was and is either automatically started when PHP is configured to autostart sessions upon request start or manually by calling session_start().

Starting with PHP 7, session_start() accepts a configuration array to allow overwriting any previously configured ini setting that deals with the session subsystem.

Additionally, a new runtime only option can be included into this configuration array: read_and_close. If set to true, this option will result in the session being closed immediately after it was read. This avoids unnecessary locking in case the session data does not need to be changed during this request – for instance during an HTTP GET request – and enables multiple concurrent processes to read the session information at the same time. To ensure consistency of the data contained within the sesison in this mode, any modification to $_SESSION is silently discared at the end of the request.