Using sessions

Sessions are great for storing temporary data about your visitors, particularly when you do not want that data to be accessible from outside of your server. Using sessions before PHP 4.1 was much harder than it is today - if you are used to having to use functions to set and unset session variables, you should pay extra-special attention to this text on sessions, because things have changed substantially as a result of the superglobal $_SESSION array.

 

Want to learn PHP 7?

Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!

If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!

Next chapter: Starting a session >>

Previous chapter: Using cookies

Jump to:

 

Home: Table of Contents

Copyright ©2015 Paul Hudson. Follow me: @twostraws.