Strip HTML Entities

Last modified: 
Tuesday, May 5th, 2015

This is a PHP function to strip HTML entities from a string.

 * Strips HTML entities from a string.
 * @param STRING $str The string to clean.
function removeHtmlEntities($str) {
  $regex = '@&\w+;@i';
  return preg_replace($regex, '', $str);

The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.