Re: Sessions and Classes

From: Date: Wed, 06 Feb 2002 08:39:58 +0000
Subject: Re: Sessions and Classes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-83684@lists.php.net to get a copy of this message
> What is the proper way to transfer class properties through-out my > pages... > > if (!session_is_registered("myCart")){ > $myCart = new ShoppingCart(); > .... (some other stuffs...) > session_register("myCart"); > } you dont need to do this, > else { > $myCart = new ShoppingCart(); > } as far as i have experienced. the type of the session variable is saved in the session too, so php automatically realizes that "myCart" is an instance of "ShoppingCart", you only need to be sure to have the class "ShoppingCart" defined before you start the session, if i remember right that's at least how i do it and it works already for quite a while very well :-) -- Wolfram

« previous php.general (#83684) next »