Objects and PHP 4.4.4

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jonathan14
Forum Newbie
Posts: 1
Joined: Wed Dec 06, 2006 11:44 am

Objects and PHP 4.4.4

Post by jonathan14 »

Hello


Im a PHP newbie and I have a question about using objects.

My scenario is this:

1. I have 3 PHP pages and on the first page I want to collect some data from the user and store it on the session
2. On the next 2 pages I want to add more data to the session and then retrieve all the data and send an email after submitting the last page


I was thinking about creating an object to store all my data on the first page and put it on the session for the other pages to get at it rather than sending data over in the request each time - and put/get to/from session each time I want to update propertys in it.


Can anyone telll me if this sounds possible in PHP 4.4.4? I know this version of PHP is limited in its OO features but I would ideally like to work with objects since this it what I know.

Its just that Im collecting quite a lot of data and I just thought putting it all in 1 object would simplify persisting it.

Any recommendations for best persisting a large number of variables betwwen page requests would be good.


Thanks
Jon
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

An object is no more simple to persist in a session than individual variables. Sure, you can do it, but it's added overhead, not much, but it adds up.

I'm not really sure what you need to find out though... How to dynamically add instance properties?

Personally, I'd suggest sticking to the array construct that $_SESSION already provides.
Post Reply