I’m not calling session_start() and php.ini has session.auto_start = 0.
I can still assign variables to the scope without any errors? No cookie is set but the scope is still available throughout the page. Should PHP raise an error if I haven’t started the session?
Since $_SESSION is a superglobal, it’s available in all scopes at all times.
Just because the session itself hasn’t been initialized with the browser, that doesn’t mean that this variable doesn’t exist. It’s still there waiting to be used, and you’re free to store to it at any time, but my understanding is that it will be wiped out if you write to it, then initialize the session.
edit:
This code results in
two => Secondas expected.