Here is a situation:
Tim, Rob and Jim live togather. Jim had a guitar, which he sold to Tim. Jim bought a new pair of fashionable shoes by this money. Rob accidently broke Tim's guitar (which he bought from Tim), After this, Rob gifted angry Tim a toy guitar, which Tim took no time to break.
Here is the array of activities that had been done in the room, lastest activity first.
$all_users_activities = array(
case1 => array(username =>'Tim', activity => 'broken', object_type => 'toy', objectname=> 'Guitar'),
case2 => array(username =>'Rob', activity => 'gifted', object_type => 'toy', objectname=> 'Guitar'),
case3 => array(username =>'Rob', activity => 'broken', object_type => 'music', objectname=> 'Guitar'),
case4 => array(username =>'Tim', activity => 'bought', object_type => 'music', objectname=> 'Guitar'),
case5 => array(username =>'Jim', activity => 'bought', object_type => 'fashion', objectname=> 'shoes'),
case6 => array(username =>'Jim', activity => 'sold', object_type => 'music', objectname=> 'Guitar')
);
Now, I want to sort this data according to:
- username
- objectname (where 'object_type' is same: 'toy''guitar' is different from 'music''guitar')
- activity