How can session_set_cookie_params() be used to manage the lifespan of a session cookie in PHP?

Session cookies in PHP have a default lifespan of until the browser is closed. To manage the lifespan of a session cookie, you can use the session_set_cookie_params() function to set the expiration time of the cookie. This allows you to control how long the session cookie will persist on the user's browser.

// Set the session cookie lifespan to 1 hour
session_set_cookie_params(3600);

// Start the session
session_start();