-5

I am retrieving data from two place one is database and other is text file. Register company information is retrieve from database and demo company's information is retrieve from local text file.

In both file created_date field is available and I want to sort data according to created_date. And then display the information in sorted list via php.

How can this possible?

Abdulla Nilam
  • 29,776
  • 14
  • 53
  • 77
  • 2
    You need to post your array structure along with expected output – Narendrasingh Sisodia Jul 13 '15 at 06:32
  • 3
    Could this question be any more vague? – Lance Jul 13 '15 at 06:36
  • I have want to retrieve information for two kind of company one is demo and other is registered. Information of register company is stored in database and information of demo company is in text file. So I want ot display this both information in UI and sort this data according to created_date filed. – Lokesh Bhandari Jul 13 '15 at 06:42
  • where is your CODE? this site is mainly about CODE and problems with CODE. so where is your CODE, so we can look at your CODE and maybe help you with your CODE? – low_rents Jul 13 '15 at 06:51

1 Answers1

0

There are plenty of sorting algorithms to implement in PHP. You can use usort() function to sort array.

$preSort = array(5, 9, 2, 1);

usort($preSort, function ($a, $b) {
    return $a - $b;
});
Justinas
  • 34,232
  • 3
  • 56
  • 78