PHP Sessions Video Tutorials – Part 3

February 17, 2008

This is part 3 (of 3) of my video tutorials that introduces PHP sessions to beginners.

php sessions video tutorial

The video:

PHP session video tutorial – part 3

Notes from the videos:

Session ID:

PHP sessions create a unique id that is passed on to the user by either a cookie or in the URL string. To be clear, the actual information tracked about the user is stored on the server, the cookie or URL string only contains the unique id that is automatically generated by the PHP session object.

How long do sessions last?

By default, sessions are set to last 24 minutes – although your hosting company could set this to any length of time they want. Once a session expires, the server deletes all information associated with that session. Sessions are kept active by the user hitting pages that have session enabled.

Remember that sessions are not meant as a long term storage solution, that is what databases are for.

Sessions are arrays:

Sessions are auto global associative arrays (on steroids) that can be accessed on any session enabled page. This is yet another example of why knowing arrays is so important in PHP … and in programming in general.

Sessions have to be declared at the very top of the PHP page!

To use session in a PHP page, it needs to be declared at the very top of the page, before anything else, otherwise you will get an error.

If any of the above points confuse you, all you need to do is watch the videos and it will all magically become clear.


The video:

PHP session video tutorial – part 3


Stefan Mischook

2 Responses

  1. Eric Kadlec Author April 23, 2010 at 7:39 am Reply

    Do you accept guest posts? I like the way how you wrote
    PHP Sessions Video Tutorials – Part 3 – Blog , I am in this topic for ages and I would adore to write two or three articles here in case you agree with me.

  2. Stefan Mischook Author April 30, 2010 at 9:15 am Reply

    We do sometimes, just send me an email (stefan at and I will take a look.


Leave a Reply

Your email address will not be published. Required fields are marked *

To Top