If after all the abovementioned, you still do not understand what sessions are for, we will have a practical example. Imagine that you are trying to create a shopping cart system , which in its basic form could be something like this:
A brief explanation: on row 4 we verify whether the user has inserted any item from the form. If the array itemsInCart does not exist on line 5, we create it with the new product and the indicated amount. If the array exists, move along its content between lines 8 and 13, therefore if we find a similar product, we will add the new product and corresponding amount to itemsInCart on row 14.
Next, we print the form and results, if any, starting on line 18, where HTML begins.
Could you imagine the possibilities of an information storing system with these characteristics? No need for files, or databases, or having to move values from one page to another. PHP is managing this data for us, until the moment we decide to store information that is important to us.
These are the basic functions of sessions, I hope this may be useful and do not forget to consult the rest of the statements associated with the use of sessions in the PHP manual.