title: Line breaks not working in my php program?
body: <p>When I write a string to the text file "words.txt" in my php program, the line breaks(<code>\n</code>, <code>&lt;br&gt;</code>), do not work and everything I read from the file appears on one line. </p>
  
  <p>I have tried using <code>&lt;br /&gt;</code>, <code>/n</code>, <code>\n</code>, <code>&lt;br&gt;</code>. I have tried putting them in different places(where I write the file, and where I read the file).  </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Glossary&lt;/title&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;form action="index.php" method="post"&gt;
              &lt;input type="text" name="word"&gt;
              &lt;input type="submit" value="submit"&gt;
          &lt;/form&gt;
      &lt;/body&gt; 
  &lt;/html&gt;
  &lt;?php
      $word = $_POST['word'];
      $outPutString = $word.'&lt;br&gt;'; 
  
      $fp = fopen('words.txt', ab);
      flock($fp, LOCK_EX);
      fwrite($fp, htmlspecialchars($outPutString), strlen(outPutString));
      flock($fp, LOCK_UN);
      fclose($fp);    
  ?&gt;
  &lt;?php
  
      $fo = fopen('words.txt', rb);
      flock($fo, LOCK_SH);
      while(!feof($fo)) {
          $words = fgets($fo);
          if(!feof(fo)){
              echo htmlspecialchars($words)."&lt;br /&gt;";
          }
      }
      flock($fo, LOCK_UN);
      fclose($fo);
  ?&gt;
  </code></pre>