title: php how to create file in specific directory
body: <p>How would I create a file in a specific directory? </p>
  
  <p>this is my code at the moment : <br></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>$username = $_POST["username"];
  
  $filedir = "./u/".$username;
  
  mkdir($filedir);
  
  $folder = $filedir;
  chmod($filedir, 0777);
  
  $createfile = fopen( $_SERVER['DOCUMENT_ROOT'] . '/path/filename.php' );</code></pre>
  </div>
  </div>
  
  <br> 
  I have also tried fopen but that didn't work :(<br><br></p>
  
  <p>I HAVE GOT IT!!! It was </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>$createfile = fopen('./u/'.$username.'/'.$username.'.php', 'x');</code></pre>
  </div>
  </div>
  
  <br>
  Thanks for all the help guy :) really appreciated.</p>