title: PHP fopen does not working with directory variable
body: <p>I have a php code that it creates a random name, then creates the directory, and then I need to create and write a text file inside the directory. 
  It creates the directory, but nothing when it need to create the text file.
  This is what I have:</p>
  
  <p>This create the random name</p>
  
  <pre><code>$letra1 = chr(rand(65,90));
  $letra2 = chr(rand(97,122));
  $letra3 = chr(rand(65,90));
  $letra4 = chr(rand(97,122));
  </code></pre>
  
  <p>This join all the characters:</p>
  
  <pre><code>$letras = $letra1 . $letra2 . $letra3 . $letra4;
  </code></pre>
  
  <p>This creates de directory:</p>
  
  <pre><code>mkdir("a/$letras", 777);
  </code></pre>
  
  <p>And here, where i think I have the problem, the fopen:</p>
  
  <pre><code>$archt = fopen("a/$letras/text.txt", "w") or die("");
  $txt = "";
  fclose($archt);
  </code></pre>
  
  <p>I think it isn't a perms problem, I have given 777 to all directories...</p>
  
  <p>I have tried a lot of stuf that I have been searched from stackoverflow but nothing is working for me and don't know what it will be?</p>