note 33767 added to function.is-a
| From: | kerxen at caramail dot com | Date: | Mon, 07 Jul 2003 10:39:58 +0000 |
| Subject: | note 33767 added to function.is-a | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51618@lists.php.net to get a copy of this message | ||
>>> USE OF CLASSES, OBJECTS and SESSIONS. <<<
If you have an object, or an array that used in many pages, you need to serialize/unserialize it.
exampla:
include("class.example.php");
$object = new example ();
$se_obj = serialize($object);
$_SESSION['se_obj']=$se_obj; // here, the object is is the SESSION as a global variable
It won't be destroyed when you change pages.
when you then got on the next page and so a session_start(), you must have included a class
definition first.
and you don't habe included the class description, your object will still not break.
Just do a:
include("class.example.php");
$object = unserialze($_SESSION['se_obj']);
and all is fine.
Eddy Cingala
----
Manual Page -- http://www.php.net/manual/en/function.is-a.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33767
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33767&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33767&report=yes