title: fopen not allowing a variable for file name to create
body: <p>I am trying to create a file and write to it line by line.  When trying to create the file using a file name from a variable, it fails.  but if I hard code the file name it works.</p>
  
  <p>The echos are:</p>
  
  <blockquote>
    <p>Unable to open/create file: CleanStatements\Clean_IRS01HHTAX.TXT</p>
  </blockquote>
  
  <p>This works:</p>
  
  <pre><code>if ($handle) {
          $cleanFileHandle = fopen( "CleanStatements\\Clean_IRS01HHTAX.TXT", "w") or die("Unable to open/create file: ".$this-&gt;CleanFilePath);
          while (($line = fgets($handle)) !== false) {
              fwrite($cleanFileHandle, $line);
          }
          fclose($cleanFileHandle);
          fclose($handle);
      } else {
          // error opening the file.
      }
  </code></pre>
  
  <p>This Does Not</p>
  
  <pre><code>if ($handle) {
          $cleanFileHandle = fopen( $this-&gt;CleanFilePath, "w") or die("Unable to open/create file: ".$this-&gt;CleanFilePath);
          while (($line = fgets($handle)) !== false) {
              fwrite($cleanFileHandle, $line);
          }
          fclose($cleanFileHandle);
          fclose($handle);
      } else {
          // error opening the file.
      }
  </code></pre>
  
  <p>Here is the full class:</p>
  
  <pre><code>/**
   * Class StatementFile
  */
  class StatementFile
  {
  var $Name;
  var $FilePath;
  var $Type;
  var $CleanFileName;
  var $CleanFilePath;
  
  function __construct($filePath){
      $this-&gt;Name = basename($filePath).PHP_EOL;
      $this-&gt;FilePath = 'Statements\\'.$filePath;
      $this-&gt;Type = null;
      $this-&gt;CleanFileName = "Clean_".$this-&gt;Name;
      $this-&gt;CleanFilePath = "CleanStatements\\" . $this-&gt;CleanFileName;
  }
  
  function cleanStatement(){
      $handle = fopen($this-&gt;FilePath, "r");
      echo "Opening file: ".$this-&gt;FilePath ."&lt;br/&gt;";
      if ($handle) {
          $cleanFileHandle = fopen( $this-&gt;CleanFilePath, "w") or die("Unable to open/create file: ".$this-&gt;CleanFilePath);
          while (($line = fgets($handle)) !== false) {
              // process the line read.
              // clean line here
              fwrite($cleanFileHandle, $line);
          }
          fclose($cleanFileHandle);
          fclose($handle);
      } else {
          // error opening the file.
      }
  }
  </code></pre>