session is a variable
value is stored in a file (for remember the value)
now a variable can not be same time 2 different values
$a = 1; can not be same time $a = 2;
For every user that visit your page, with session_start() there is a new session file created.
So if 2 users come, say first have id=1 and second have id=2
and you store id-num in $_SESSION['id'],
there will be 2 session files created with each id-num.
In one file $SESSION['id'] will be 1
in the other file $SESSION['id'] will be 2
This way, for each user connected, can be checked if user number 'x' is logged in.
When any user close down his browser, 'his own' session file goes empty.
The value for that user is no longer.
He is 'logged out', as seen from $_SESSION file, at least.
🙂