Skip to content

Instantly share code, notes, and snippets.

@clemgrim
Created June 9, 2016 15:43
Show Gist options
  • Save clemgrim/1aa94b60330a9e40f18795784f3d3ec6 to your computer and use it in GitHub Desktop.
Save clemgrim/1aa94b60330a9e40f18795784f3d3ec6 to your computer and use it in GitHub Desktop.
<?php
$str = htmlentities($str, ENT_NOQUOTES, 'utf-8');
$str = preg_replace('#&([A-za-z])(?:acute|cedil|caron|circ|grave|orn|ring|slash|th|tilde|uml);#', '\1', $str);
$str = preg_replace('#&([A-za-z]{2})(?:lig);#', '\1', $str);
$str = preg_replace('#&[^;]+;#', '', $str);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment