0

I have 2 seperate arrays called $all_requests_messages and $all_messages.

These 2 array results are taken from same table but on applying different queries .Now i need to merge 2 arrays and list the result based on the primary key of the table. Is it possible ?

$all_requests_messages = $this->users_model->getAllRequests_Messages($arr['user_id']);

$all_messages = $this->users_model->getTypeMessage($arr['user_id'],0);


$all_requests_messages = array_merge($all_messages,$all_requests_messages);

need to sort the $all_requests_messages based on primary key value of the table .

Sadikhasan
  • 17,212
  • 19
  • 72
  • 111
Deva
  • 3
  • 4
  • [`usort()`](http://php.net/usort) or [`uasort`](http://php.net/uasort) come to mind. – Ja͢ck Mar 28 '14 at 05:43
  • possible duplicate of [Reference: all basic ways to sort arrays and data in PHP](http://stackoverflow.com/questions/17364127/reference-all-basic-ways-to-sort-arrays-and-data-in-php) – Ja͢ck Mar 28 '14 at 05:44
  • Why not do your thing on query, subquery maybe. – YouSer Mar 28 '14 at 05:48

0 Answers0