I would like to sort strings in PHP, and the match should be done foremost on the first letters of a substring, then on the letters of the whole the string.
For example, if someone searches do, and the list contains
Adolf
Doe
Done
the result should be
Doe
Done
Adolf
Using the regular sort($array, SORT_STRING) or things like that does not work, Adolf is sorted before the others.
Does someone have an idea how to do that?
OdometerandAbdomen, how should it be sorted?