Search code examples
phperror-handlingopendir

Error handling opendir


I always get a warming when I tried to use the opendir() but the folder does not exists. How can I handle this error, and verify if the folder exists before open the directory?


Solution

  • is_dir($directory)

    Returns TRUE if the filename exists and is a directory, FALSE otherwise.