CodeIgniter Forums

Full Version: serialize or convert array to strings?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I'm curious what the thought is on storing array contents to the database?

I've most always converted the array to a string, stored it to the db, and then did the reverse on the way out. Have recently started using 'serialize/unserialize' to do the same.

Using these functions means a lot less overhead, in terms of code I need to maintain. But, my newness to using these functions has me curious if there's any drawbacks I need to know about?



El Forum

That's exactly what those functions are intended for, converting an array/object to a string.

El Forum

[eluser]Victor Michnowicz[/eluser]
Also have a look at json_encode. It may be faster.