You should definitely go for Sessions. It saves you bandwidth consumption and is much easier to handle. Unless, of course, you need the data on the client-side, which, by your explanation, I assume you don't. Assuming you went for sessions, all you gotta do is store an array with the data you have. The following code should do it:

$aClicks = $this-&gt;session
                -&gt;userdata('article_clicks');

// Initialize the array, if it's not already initialized
if ($aClicks == false) {
    $aClicks = array();
}

// Now, we clean our array for the articles that have been clicked longer than
// 10 minutes ago.
$aClicks = array_filter(
    $aClicks,
    function($click) {
        return (time() - $click['time']) &lt; 600; // Less than 10 minutes elapsed
    }
);

// We check if the article clicked is already in the list
$found = false;
foreach ($aClicks as $click) {
    if ($click['article'] === $id) { // Assuming $id holds the article id
        $found = true;
        break;
    }
}

// If it's not, we add it
if (!$found) {
    $aClicks[] = array(
        'article' =&gt; $id, // Assuming $id holds the article id
        'time'    =&gt; time()
    );
}

// Store the clicks back to the session
$this-&gt;session
     -&gt;set_userdata('article_clicks', $aClicks);


// If we meet all conditions
if (count($aClicks) &lt; 10) {
    // Do something
}


How to remember 10 last read articles with timestamp in session for a user in Codeigniter?
Lets say we have a product that costs 100$ (net price). This product has 3 taxes that must be applied to it: 2 percentage taxes (e.g. 17% and 20%) and one fixed amount tax (e.g. +10$).

My question is - what math is done in this case?

Are the percentage taxes applied on the net price and summed or the first one is calculated and then the second one is done with the price we get after applying the first? When is the fixed amount tax applied? After the other two or the other two are done with net+fixed tax?
