title: PHP Replacing swear words with phrases
body: <p>So I get how to replace certain words with other ones. What I'm trying to figure out is how to take a word and replace it with a phrase and eliminate all other input.</p>
  
  <p>For example:</p>
  
  <p>bad word is 'dog'</p>
  
  <p>user inputs -> 'You smell like a dog.'</p>
  
  <p>instead of it replacing 'dog' with 'rainbow' or something, I want it to echo something like: 'You are a potty mouth'.</p>
  
  <p>Here's what I have for code:</p>
  
  <pre><code>&lt;?php
  
  $find = array('dog', 'cat', 'bird');
  $replace = 'You are a potty mouth.';
  
  if (isset ($_POST['user_input'])&amp;&amp;!empty($_POST['user_input'])) {
      $user_input = $_POST['user_input']; 
      $user_input_new = str_ireplace($find, $replace, $user_input);
  
          echo $user_input_new;
  }
  ?&gt;
  </code></pre>
  
  <p>With this code it echos: 'You smell like a You are a pottymouth.'</p>
  
  <p>I'm sure this is a repost and I apologize. Everything I've been able to find is documentation on how to replace only parts of strings, not entire ones. </p>