Reading session data
Once you have put your data safely away, it becomes immediately available in the $_SESSION superglobal array with the key of the variable name you gave it. Here is an example of setting data and reading it back out again:
<?php
$_SESSION['foo'] = 'bar';
print $_SESSION['foo'];
?>
Unlike cookies, session data is available as soon as it is set, which can be quite an advantage.
Next chapter: Removing session data >>
Previous chapter: Adding session data
Jump to:
Home: Table of Contents



Copyright 2012 Future Publishing Limited (company
registered number 2008885), a company registered
in England and Wales whose registered office is at
Beauford Court, 30 Monmouth Street, Bath, BA1 2BW, UK