Created
February 12, 2019 19:04
-
-
Save donwilson/3f4b8abf7e9ea144df030deff0316e8a to your computer and use it in GitHub Desktop.
function to strip zalgo/"scary" text from regular strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// zalgo text/scary text stripper | |
// https://stackoverflow.com/a/32921891/103337 | |
function strip_utf8_zalgo_text($string="") { | |
$string = preg_replace("~(?:[\p{M}]{1})([\p{M}])+?~uis", "", $string); | |
return $string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment