title: Fixing weird indentation in text file with php
body: <p>I'm taking <a href="http://www.anc.org/MASC/texts/Homosexuality.txt" rel="nofollow noreferrer">this file</a> and splitting it up into sentences. The issue is that its formatted weirdly. I need to remove all the random new lines, indentations and unneeded spaces. Is there a way to do this with php?</p>
  
  <p>I am currently using </p>
  
  <pre><code>$test= file_get_contents("text.txt");
  $stringtest = str_replace(PHP_EOL,'', $test);
  </code></pre>
  
  <p>But I am getting weird behavior when I try to split up the sentences. Is there a way to do this?</p>
  
  <p>The weird behavior is that when I print out the text</p>
  
  <pre><code>echo $stringtest;
  </code></pre>
  
  <p>There are unseen characters between lines where a newline/weird_spacing used to exist.</p>