The PHP Function Session_Start
PHP's session variable, $_SESSION, is like a super-global that's shared between web requests. The session data initialized on one page is accessible from other pages on the website, until the web server closes the browser or the website's sessions expire.
The session_start() function is called whenever a page in the site wants to start a new session. It checks to see if a session exists, and if not, it creates one. It also generates a unique session ID for the current user.
This function is very useful for storing information that needs to be available across multiple pages. The session_start() function should always be placed as the very first line of code in the file, before any HTML tags.
It's important to note that while you can store objects in a session, doing so can cause problems down the road when it comes to restoring them from a session. Objects that are stored in a session will lose their static properties, which may lead to errors after they're restored from the session.
Another thing to keep in mind is that the session_start() function locks the session data during a request. This is to prevent session corruption between requests. This means that if a request is made for Session 1, PHP will block other requests until the session_close() or session_write_close() function is called to flush the current session data and release the lock.