Array_unique funny story

Here is a funny story about an “error” I thought I was dealing with recently with PHP and arrays. Assume you have a simple array (elements are keyed by incremental numbers – default assignment when you use $a[] = 1) with many elements (let’s say 10.000) whose unique values you wish to save in your database for later use. So how did I choose to implement this? I run my array through PHP’s array_unique and then serialize it and then store it in the database for later!

Continue reading “Array_unique funny story”