Hey,
I am trying to sort an array sorting by numbers first and letters second.
For example: an array could look like $array = ('1', 'C9', 'E2', '2', 'C11', ... etc.);
I would like it to output in the order: 1, 2, C9, C11, E2. But right now the code I have outputs: C9, C11, E2, 1, 2. Any help is appreciated. Thanks!
A sorting question
Moderator: General Moderators
Re: A sorting question
Try natsort() or natcasesort().
It that isn't suitable, write your own comparison function and use usort().
It that isn't suitable, write your own comparison function and use usort().
Re: A sorting question
natsort() worked. Thank you for the suggestion.