algorithm for sorting string number in php

63 views Asked by At

I want to write a program that take string numeric as input(eg,one,two,three etc) and output will be sorted by ascending order or descending order of that string and show it in string as given in input.

Example:

Input:five,two,seven,ten,four

Output:two,four,five,seven,ten

1

There are 1 answers

3
PanicMan On

Interesting problem... You could use that Package: Numbers_Words It has til now only the function "toWords", but should easily be extended with toNumbers. Just downloaded it an looked into the code, don't look to complicated.