note 107717 added to function.serialize
| From: | Anonymous | Date: | Tue, 28 Feb 2012 19:44:56 +0000 |
| Subject: | note 107717 added to function.serialize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186418@lists.php.net to get a copy of this message | ||
Please! please! please! DO NOT serialize data and place it into your database. Serialize can be used
that way, but that's missing the point of a relational database and the datatypes inherent in
your database engine. Doing this makes data in your database non-portable, difficult to read, and
can complicate queries. If you want your application to be portable to other languages, like
let's say you find that you want to use Java for some portion of your app that it makes sense
to use Java in, serialization will become a pain in the buttocks. You should always be able to query
and modify data in the database without using a third party intermediary tool to manipulate data to
be inserted.
I've encountered this too many times in my career, it makes for difficult to maintain code,
code with portability issues, and data that is it more difficult to migrate to other RDMS systems,
new schema, etc. It also has the added disadvantage of making it messy to search your database based
on one of the fields that you've serialized.
That's not to say serialize() is useless. It's not... A good place to use it may be a
cache file that contains the result of a data intensive operation, for instance. There are tons of
others... Just don't abuse serialize because the next guy who comes along will have a
maintenance or migration nightmare.
----
Server IP: 69.147.83.197
Probable Submitter: 98.140.84.195
----
Manual Page -- http://www.php.net/manual/en/function.serialize.php
Edit -- https://master.php.net/note/edit/107717
Del: integrated -- https://master.php.net/note/delete/107717/integrated
Del: useless -- https://master.php.net/note/delete/107717/useless
Del: bad code -- https://master.php.net/note/delete/107717/bad+code
Del: spam -- https://master.php.net/note/delete/107717/spam
Del: non-english -- https://master.php.net/note/delete/107717/non-english
Del: in docs -- https://master.php.net/note/delete/107717/in+docs
Del: other reasons-- https://master.php.net/note/delete/107717
Reject -- https://master.php.net/note/reject/107717
Search -- https://master.php.net/manage/user-notes.php