title: fopen() and save as - php
body: <p>I have this issue, I would like to create a new file, with another name. </p>
  
  <p>For now I have the file CLPRE.txt opened and saving the changes in the same file, I would like to create a new file from the original one like this</p>
  
  <blockquote>
    <p>pseudo-code:</p>
    
    <p>$unique= sha1( uniqid(phc) );</p>
    
    <p>$newFile = $unique.CLPRE.txt</p>
  </blockquote>
  
  <p>The actual code is resumed with this:</p>
  
  <pre><code>$myFile = $loja."/CL.xml";
  $fh = fopen($myFile, 'w') or die("can't open");
  $pre= file_get_contents('CLPRE.txt');
  $writeThis = "some text";
  fwrite($fh, $pre.$writeThis);
  fclose($fh);
  </code></pre>