Arranging words in alphabetical order

Discuss Arranging words in alphabetical order in the PHP Development forum on Dev Articles. Arranging words in alphabetical order PHP Development forum to discuss anything related to developing applications in PHP. Topics include architecture, coding standards, and debugging methods.

Hi there,
I have a little bit specific problem. I would like to create a script that would read words from a text file and rearange them in alphabetical order. I know it could be easily done using an array but my problem is that I would like to arrange the words form the last letter.
Small example:
the words - a, actual, an, and, brother
would be arranged

a, and, actual, an, brother - because of the alphabetical order - but from the last letter of the word.

There is also one problem - I am from Slovakia and we have little more characters in out alphabet.

Please, if anyone can give me a hand how can I do something like reversing the letter order of the words then delete the words that are repeating, order the words alphabetically and then reverse them again. Thant would do the trick - I just cannot figure out how to do it