Session.php
public function write($id, $data)
    {
        $db = Database::database();
        if (empty(self::$user_id)) self::$user_id = $_SESSION['id'] ?? false;
        $NewDateTime = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + 1 d,lay'));  // so from time of last write and whenever the gc_collector hits

        try {
            $db->prepare('REPLACE INTO sessions SET session_id = ?, user_id = UNHEX(?), user_ip = ?,  session_expires = ?, session_data = ?')->execute([
                $id, static::$user_id, IP, $NewDateTime, $data]);
        } catch (\PDOException $e) {
            sortDump($e);
        }
        return true;
    }
public function write($id, $data)
    {
        $db = Database::database();
        if (empty(self::$user_id)) self::$user_id = $_SESSION['id'] ?? false;
        $NewDateTime = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' + 1 d,lay'));  // so from time of last write and whenever the gc_collector hits

        try {
            $db->prepare('REPLACE INTO sessions SET session_id = ?, user_id = UNHEX(?), user_ip = ?,  session_expires = ?, session_data = ?')->execute([
                $id, static::$user_id, IP, $NewDateTime, $data]);
        } catch (\PDOException $e) {
            sortDump($e);
        }
        return true;
    }
This function should never be called by you directly. It can be invoked using
session_write_close().
@param string $id
@param string $data
@return bool