1 | initial version |
To eliminate the Unicode Zero Width Space in PHP, you can use the str_replace function to replace it with an empty string.
Here's an example:
$string = "Hello World!"; // has zero width space after 'o'
$newString = str_replace("\u{200b}", "", $string);
echo $newString; // outputs "Hello World!"
In this example, we use the \u{200b}
escape sequence to represent the Zero Width Space character and replace it with an empty string. The resulting string will not contain the Zero Width Space.