Sort an array:


SUBMITTED BY: henry1874w

DATE: June 27, 2017, 5:06 p.m.

FORMAT: Text only

SIZE: 257 Bytes

HITS: 294

  1. <?php
  2. $temp_files = array("temp15.txt","temp10.txt",
  3. "temp1.txt","temp22.txt","temp2.txt");
  4. sort($temp_files);
  5. echo "Standard sorting: ";
  6. print_r($temp_files);
  7. echo "<br>";
  8. natsort($temp_files);
  9. echo "Natural order: ";
  10. print_r($temp_files);
  11. ?>

comments powered by Disqus