title: How to use PHP mkdir function recursively to skip existing directory and to create new one?
body: <p>How to use PHP mkdir function recursively to skip existing directory and to create new one from the <code>string $pathname</code></p>
  
  <pre><code>// works fine if directories don't exist
  mkdir($root_dir . '/demo/test/one', 0775, true);
  
  // It will throw error - Message: mkdir(): File exists
  mkdir($root_dir . '/demo/test/two', 0775, true);
  </code></pre>
  
  <p>What is the solution?</p>