title: Restrict characters used in a string
body: <p>How do I restrict a string to whitelisted characters?</p>
  
  <pre><code>// "HOW am I to understand; this is, BAD"
  
  $str = restrictTo($str,"0-9a-z,. ");
  
  // " am I to understand this is, "
  </code></pre>
  
  <p>Is there an inbuilt function in PHP that does something close? I can't formulate a regular expression for this though :(</p>