Using the sorting algorithim for php