Forked from ahmadazimi/replace-zero-width-space.php
Created
February 27, 2018 01:05
-
-
Save ye-fight/b948755a67dcd1450b5c25270cde2b0a to your computer and use it in GitHub Desktop.
PHP replace Zero Width Space using preg_replace
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 | |
/** | |
* http://stackoverflow.com/questions/11305797/remove-zero-width-space-characters-from-a-javascript-string | |
* U+200B zero width space | |
* U+200C zero width non-joiner Unicode code point | |
* U+200D zero width joiner Unicode code point | |
* U+FEFF zero width no-break space Unicode code point | |
*/ | |
$text = preg_replace( '/[\x{200B}-\x{200D}]/u', '', $text ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment