note 13677 added to function.session-register.php

From: Date: Thu, 28 Jun 2001 16:58:56 +0000
Subject: note 13677 added to function.session-register.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-14725@lists.php.net to get a copy of this message
Found get around for defining class before session_start() call. Serialize your object and store it in session as a string. When you need it, just pick string variable up and unserialize it. Example: Registering: session_start(); // you can define Bummer here class Bummer .... $bum=new Bummer(); $bum->id = session_id(); $bum->object_name = "bummer"; $ser_bum=serialize($bum); session_register("ser_bum"); Getting object back: session_start(); $bum = unserialize($ser_bum); http://www.php.net/manual/en/function.session-register.php

« previous php.notes (#14725) next »