A couple of notes:
glob() handles symbolic filesystem links and resolves references to './', '../' nicely and handles an extra '/' character , at least on X-systems. e.g., glob("../*") will do next higher dir.
This is good to use so warnings or errors show as "../foo" and not your system's full path.
Several of the examples use a notation "*.*" when just plain "*" does the same thing. The "*.*" notation is misleading as it implies foo.ext will not be found with "*" because the "." is not present.
Watch the flags must not be strings. They are defined constants. Thus,
glob("../*", GLOB_ONLYDIR) works;
glob("../*", "GLOB_ONLYDIR") does not.