Here is my current code to add to the array:
foreach ($query->result() as $exp) {
$activities[] = array('type' => 'level', 'exp' => $exp->exp, 'timestamp' => $badge->timestamp);
}
How would I go about sorting this array according to the value of the ‘timestamp’ key?
You would need to use
usortwhich will let you sort the array using a user-defined function.http://www.php.net/manual/en/function.usort.php
Example: