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

Thanks,

Stefan Mischook

www.killerphp.com

Comments

Comments are closed.

To Top