Check if directory exists (PHP)
<p>I want to create a directory if it does not exist, for that purpose, is only is_dir function ok to check? For example:</p>

<pre><code>if(!is_dir($dir)){
        mkdir($dir);         
        } 
</code></pre>

<p>OR i should use file_exists also? For example:</p>

<pre><code> if(!file_exists($dir) OR !is_dir($dir)){
        mkdir($dir);         
        } 
</code></pre>

<p>Thanks.</p>
