Skip to content

Instantly share code, notes, and snippets.

@EncodeTheCode
Created August 5, 2017 03:17
Show Gist options
  • Save EncodeTheCode/75ddadabfc179a1d1a65e66b11939896 to your computer and use it in GitHub Desktop.
Save EncodeTheCode/75ddadabfc179a1d1a65e66b11939896 to your computer and use it in GitHub Desktop.
function sanitize_string($s) {
$r=preg_replace('/[^-_a-zA-Z0-9 `´¨¢$!?#&£€@×÷§©®°«»¥¡¿µ™…\Â\â\á\Á\à\À\ã\Ã\Ê\ê\É\é\È\è\Ë\ë\Î\î\Í\í\Ì\ì\Ï\ï\^\¹\²\³\¼\½\¾\+\=\~\‹\›\|\(\)\{\}\[\]\·.\w]+/','',html_entity_decode($s,ENT_QUOTES));
return $r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment