EP String Sorter

Published on: October 17, 2015

This script takes your input and sorts it in ascending, descending, or random order. You get to choose! It separates items by line, please put a different item on each line. Other delimiters may be avialable later.

One thing to note is that this is case sensitive and follows the ASCII order. Capital letters will ALWAYS be sorted as being smaller than lower case letters. E.g. A,b,c,D,e,F will be sorted as A,D,F,b,c,e in ascending order (and the reverse in descending order). Case insensitive sorting will be an option in the future.

This script utilizes the following PHP functions: explode() - allows us to split the different lines into an array, PHP_EOL - PHP statement for "End of Line", sizeof() - to get the size of an array, asort() - Sort Ascending Order, arsort() - Sort Descending Order, shuffle() - Sort in random order.

Checkout the Codesnip section below for the link to the Github repository!


Find this code on Github here: EP String Sorter