Question: I want to create a directory if it does not exist already.

Is using the `is_dir` function enough for that purpose?

```
if ( !is_dir( $dir ) ) {
    mkdir( $dir );       
}

```

Or should I combine `is_dir` with `file_exists`?

```
if ( !file_exists( $dir ) && !is_dir( $dir ) ) {
    mkdir( $dir );       
} 

```

Answer: 
This is an old, but still topical question. Just test with the `is_dir()` or `file_exists()` function for the presence of the `.` or `..` file in the directory under test. Each directory must contain these files:

```
is_dir("path_to_directory/.");    

```
i think this is fast solution for dir check.

```
$path = realpath($Newfolder);
if (!empty($path)){
   echo "1";
}else{
   echo "0";
}

```