How can the domain setting in session_set_cookie_params impact session management in PHP?

Setting the domain in session_set_cookie_params can impact session management in PHP by restricting the session cookie to a specific domain. This can help prevent session hijacking and ensure that the session cookie is only sent to the specified domain. To implement this, you can set the domain parameter in session_set_cookie_params to the desired domain.

// Set the domain for the session cookie
session_set_cookie_params(0, '/', 'example.com', false, true);

// Start the session
session_start();