title: preg_replace with file_get_contents
body: <p>I have looked at a couple of questions here, and done a Google search but I cannot seem to find the correct way to go about doing this.</p>
  
  <p>I am using this function</p>
  
  <pre><code>function replace_c($content){
      global $db;
      $replacements = $db-&gt;query("SELECT * FROM `replacements`");
      while($replace = $replacements-&gt;fetch_assoc()){
          preg_replace("/".$replace['triggers']."/i",$replace['php'], $content);
      }
      return $content;
  }
  </code></pre>
  
  <p>and this is my call to the function</p>
  
  <pre><code>$contents = replace_c(file_get_contents("templates/" . $settings['theme'] . "/header.html"));
  </code></pre>
  
  <p>It doesn't give an error, it just doesn't replace the text like it should so I am not sure if the function is actually working. I did try <code>preg_replace_callback</code> but I don't think I fully understand how it works and was producing nothing but errors, do I have to go the callback route, or am I just missing something in my current function?</p>