I have very little experience with cookies so I don't know how to do that.

I have a t-shirt shop where each t-shirt has an `$articleID`.

Each time an user visits a t-shirt page, I would like to add the `$articleID` to a cookie. 
Then add it to an array or something so I can retrieve it later.
There shouldn't be any duplicate `$articleID` even if the visitor visited the same `$articleID` twice.

Then on the main page, I want to retrieve the list of the last 5 `$articleID` visited and display a list of the ID.

How could I do that?

Thanks!