title: remove a word from txt and save. no similar words
body: <p>I have this function:</p>
  
  <pre><code>&lt;?php
  
  $post="marie" . "\n"; // \n not working?
  
  //replace txt
  $oldMessage = $post;
  $deletedFormat = "";
  
  //read the entire string
  $str=file_get_contents('log.txt');
  
  //replace something in the file string - this is a VERY simple example
  $str=str_replace("$oldMessage", "$deletedFormat",$str);
  
  //write the entire string
  file_put_contents('log.txt', $str);
  
  ?&gt;
  </code></pre>
  
  <p>I want to find <code>marie</code> and replace it:</p>
  
  <pre><code>ANAff
  marieb
  marie
  mariec
  marie
  </code></pre>
  
  <p>So it should replace only the 3 one, but the result was:</p>
  
  <pre><code>ANAff
  b
  
  c
  </code></pre>
  
  <p>In other words, I want to remove the exactly $post value from log.txt. how to do this?
  And if possible, how to remove the full line? not let it blank.</p>