Let's see another example that may further clarify this point:
As I mentioned before, the session is created or retaken by session_start(), or also when a session variable is recorded by session_register().
If you have never used sessions, the concept session variable may seem a little abstract. Basically, it is a variable, like any other PHP4 managed variables, but it resides in a specific location on the server, along with the session identifier and belongs only to one user.
In our previous example, we recorded the variable $counter in the first row of the script. Among other things, every time we reload the page or click the link on the second row, the value of $counter will increase by 1.
In this line we use the reserved variable $PHP_SELF, that refers to the executing script, and to a PHP4 constant, $SID, that contains the session name and identifier.
We can also get the name of the session or modify it with the statement session_name(). Let's see a practical test:
The assignment of the session name shall be done before any other statement with sessions, before session_start() or session_register().