Created
December 17, 2016 05:11
-
-
Save qazd/c8883cf3458d4f6b5e6fc806a56a9f1c to your computer and use it in GitHub Desktop.
Removes unicode characters with length larger than 3 bytes from string
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 | |
$string = '🤔 THINKING 🤔 FACE 🤔'; | |
$string = preg_replace_callback('/./u', function (array $match) { | |
return strlen($match[0]) > 3 ? null : $match[0]; | |
}, $string); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment