Re: serialize/unserialize vs. implode/explode for storing array data in MySQL
| From: | Chris Adams | Date: | Mon, 09 Oct 2000 22:56:45 +0000 |
| Subject: | Re: serialize/unserialize vs. implode/explode for storing array data in MySQL | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-3443@lists.php.net to get a copy of this message | ||
> What are the pros and cons of using serialize/unserialize vs.
> implode/explode for storing array data in a MySQL database? It looks to
me
> that the serialize functions will use more space and requires addslashes()
> but is it faster/better somehow?
Implode is less sophisticated. You'll have to worry about things like
escaping metadata (e.g. in CSV, you need to handle data containing commas)
and you'll lose things like associative array keys. Nested arrays and
structures would have similar problems. serialize() will handle all of this
for you.