title: Write to file but not erase
body: <p>I have a function to write to a .txt file. my problem is that it writes only on the first line, so erases the old line for the new line. I want to append the new lines to the file.</p>
  
  <pre><code>    function logit($log,$filename = ''){
          $logfile = "log/".date('Ymd').$filename.".txt";
          if ($fh = fopen($logfile, 'w')) {
              fwrite($fh, date('H:i:s')." | ".$log."\n");
              fclose($fh);
              return 1;   
          } else
              return false;
       }
  </code></pre>