I have an array of filenames that I aquire using DirectoryIterator. I am trying to get the filenames to sort so they would be in order like so, this is the way they appear o
Not sure what you can do here. Lexically, the underscore has a higher ASCII value than any alphanumeric character.
Replacing the underscore with a low ASCII value like \x01, then sorting, then replacing the low ASCII value with an underscore, will give the result you want, but that seems pretty expensive for a trivial change in order.