php glob - 如何正确排序文件夹

I'm on localhost, win 7, xampp

Need to create divs from all (and only) folders inside ../HOME

Originally, folders are sorted by name.

$arr = glob('../HOME/*', GLOB_ONLYDIR);
$cnt = '';
foreach($arr as $el){
    $cnt .= "<div class = 'folder rfolder'>" . basename($el) . "</div>
";
}
echo $cnt;

Result - folders are sorted by the time created.

Tried - $arr = glob('../HOME/*', GLOB_ONLYDIR, GLOB_NOSORT) and getting error - only two arguments allowed.

How to get folders sorted originally - as inside source folder?

you can do it with

    $arr = glob('../HOME/*', GLOB_ONLYDIR | GLOB_NOSORT)

also, you can sort $arr using php usort function easily, do what suits you best

They are flags that can be combined using a bitwise OR

$arr = glob('../HOME/*', GLOB_ONLYDIR | GLOB_NOSORT)