title: Simple HTML DOM str_replace on plain text
body: <p>I am trying to create something where it will change all of the text on a webpage and re output it to the user. It will be changing words predefined in a database.</p>
  
  <p>I am using <a href="http://simplehtmldom.sourceforge.net" rel="nofollow">http://simplehtmldom.sourceforge.net</a> as my HTML parser. What i want todo is to change only the test inside of tags but not the tags. I thought this would work, If i echo out <code>$e-&gt;plaintext</code> it will work but then it isn't styled.</p>
  
  <pre><code>&lt;?php
  // example of how to modify HTML contents
  include('../simple_html_dom.php');
  
  // get DOM from URL or file
  $html = file_get_html('http://example.com/');
  
  $e = $html-&gt;find("html", 0);
  
  $text = $e-&gt;plaintext;
  
  $con = mysqli_connect("localhost","root","root","Words");
  $result = mysqli_query($con,"SELECT * FROM Wordsweb");
  
  //replace all words
  $English = array();
  $Simple = array();
  
  while ($row =  mysqli_fetch_array($result)){
      $English[] = $row['English'];
      $Simple[] = $row['Simple'];
  }
  
  $e-&gt;plaintext = str_replace($English, $Simple,$e-&gt;plaintext);
  echo $e;
  ?&gt;
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p><em>p.s.</em>: previously i was using <code>preg_replace_callback</code> but i was advised to use this.</p>