I got an array which contains some data like this:
$arrs = Array("ABC_efg", "@@zzAG", "@$abc", "ABC_abc")
I was trying to print the data out in this way (Printing in alphabetic order):
[String begins with character A]
ABC_abc
ABC_efg
[String begins with character other than A to Z]
@$abc
@@zzAG
I’m going to assume you mean strings starting with a letter should appear before all other strings and all strings should otherwise be sorted in the standard order.
You use
usort()and define a custom function for the ordering andctype_alpha()to determine if something is a letter or not.Output: