Easy Tutorial
❮ Func Mysqli Data Seek Func Directory Readdir ❯

PHP 7 Session Options

PHP 7 New Features

The PHP 7 session_start() function can accept an array as a parameter, allowing you to override session configuration settings in php.ini.

This feature also introduces a new php.ini setting (session.lazy_write), which is set to true by default, meaning session data is only written when it changes.

In addition to regular session configuration directives, you can include the read_and_close option in this array. If this option is set to TRUE, the session file will be closed immediately after reading, thus avoiding unnecessary file locks when the session data does not change.

Example

Set cache_limiter to private and close the session immediately after reading.

Example

<?php
session_start([
   'cache_limiter' => 'private',
   'read_and_close' => true,
]);
?>

PHP 7 New Features

❮ Func Mysqli Data Seek Func Directory Readdir ❯