Store Object in PHP Session

Viewed 8226

In PHP, is it considered best practice to store the complete object as a session variable?

From my experience, sometimes it works and sometime not. Is there any specific reason for it?

Example:

session_start();
$object = new sample_object();
$_SESSION['sample'] = $object;
2 Answers
Related