How do I list only the folders or files in a directory?

How do I list only the folders or files in a directory?
I don’t understand how to do this with the glob function, or whatever it is I’m supposed to use?

PHP: Directory Functions - Manual

PHP: Filesystem Functions - Manual

Particularly relevant: PHP: is_dir - Manual