So I am trying to sort a list of folders and files and display them alphabetical the problem appears that if someone created a folder that starts with a captial letter that folder appears first for example if I had the following folders
Array
(
[0] => .
[1] => ..
[2] => _base
[3] => template
[4] => Website
)
I would expect when using scandir (scandir($directory, SCANDIR_SORT_ASCENDING)
) to see the folders listed out as above but instead that get listed out as
Array
(
[0] => .
[1] => ..
[2] => Website
[3] => _base
[4] => template
)
How would I be able to get this list sorted the correct way so that it wouldn't be case sensitive.
This should work for you:
It sort's an array natural ignore case
See: http://php.net/manual/en/function.natcasesort.php