Is there object persistence in PHP 5?
I ask because it seems that with all the associated memory overhead with OOP, I am wondering if there is another reason for PHP to go OO besides maintainability.
Object Persistence?
Moderator: General Moderators
-
mickeyunderscore
- Forum Contributor
- Posts: 129
- Joined: Sat Jan 31, 2009 9:00 am
- Location: UK
Re: Object Persistence?
The only way I know of to accomplish object persistence is to serialize them into a cookie, or something else that you can retrieve again on the next request.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Object Persistence?
You can put them in the session. Just assign to $_SESSION. It will even serialize for you. You can serialize an object and save it to any datasource. Obviously if it has things like file handles and database connection you will need to deal with those. There are wake/sleep methods to do that too.chadlong41 wrote:Is there object persistence in PHP 5?
If you only use OO for maintainability and actually have a problem with memory usage, then you may not want to use OO.chadlong41 wrote:I ask because it seems that with all the associated memory overhead with OOP, I am wondering if there is another reason for PHP to go OO besides maintainability.
(#10850)