PHP tips : how to sort and reverse sort an array

Let’s say you had an array as following :

$time = array ("0600", "0000", "1200", "1800");

but you wanted it to be shown as

  1. 0000
  2. 0600
  3. 1200
  4. 1800

Use asort function..

asort ($time);

But you might also want to reverse order it.
Which is to show the latest possible date and time ..

arsort ($date_time_list);

Reference :

Related Post

2 Responses

  1. desa ku pilar says:

    Hello there, I believe your web site may be having browser compatibility issues.
    When I take a look at your blog in Safari, it looks
    fine but when opening in Internet Explorer, it has some overlapping issues.
    I merely wanted to provide you with a quick heads up! Aside from that,
    great blog!

  2. pub quiz austin texas says:

    DJ spins out on Saturday nights. At the end of each round
    read out the cumulative scores. Theme Format: It is almost like standard format of the pub quiz.


Leave a Reply

Your email address will not be published. Required fields are marked *