News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Lukas Smith's Blog:
To serialize or to not serialize?
June 12, 2006 @ 06:01:46

In his latest post, Lukas Smith talks about serializing data - some of the pros and cons about it, as well as his experiences with it in the development of his own framework.

In my own framework I have decided that there is plenty of structured data that I will never query on that I will just stick into the database as a serialized array. Now the other day I modified the auto type handling in MDB2's quote() method to automatically serialize array's if no type is explicitly passed to the quote() method.

I send out a question to pear-dev@ and it was not unanimously well received. So I sat down and pondered a more elegant approach. Actually there is already one approach implemented in MDB2 since ages.

This implementation uses a seperate module that abuses PHP5's overloading functionality to integrate it easily. He also looked into another solution, however - creating a "datatype map" to help with the custom automatic serialization of datatypes (not just dependant on the variable type like before). Be sure to check out the comments for more thoughts on the subject, including validation of the custom datatypes.

0 comments voice your opinion now!
serialize unserialize custom datatypes overloading modle mdb2 serialize unserialize custom datatypes overloading modle mdb2


blog comments powered by Disqus

Similar Posts

Andrew Podner: Overloading: Create PHP Class Methods on the Fly

PHPMaster.com: Taking Advantage of PHP's Built-in Server

Juan Treminio: Composer Namespaces in 5 Minutes

DevShed: Fetching Search Results as Serialized Arrays with Yahoo Web Services and PHP 5

Fabien Potencier's Blog: PHP Serialization, Stack Traces, and Exceptions


Community Events





Don't see your event here?
Let us know!


security package voicesoftheelephpant release symfony series tool framework introduction community opinion install library update language podcast interview version laravel composer

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework