How to match horizontal ellipse (...) in php

I want to replace the horizontal ellipse (...) with three periods (...) in the given line.
So far I have tried:

str_replace('โ€ฆ','...', $text);
str_replace('…', '...', $text);
str_replace('&hellips', '...', $text);

But can not get the desired result. Can you suggest some method for this.

EDIT:
Another problem that I encountered is related to the fact that I insert the ~ ... ~ u character into my editor (I use Editplus) .... are converted to a rectangle. (see screenshot). enter image description here

thanks

+6
source share
2 answers

try using preg_replace with the / u modifier (the string is treated as a unicode string):

 $result = preg_replace('~โ€ฆ~u', '...', $string); 
+2
source

try it

 str_replace('…', '...', htmlentities($text)); 
+2
source

Source: https://habr.com/ru/post/945403/


All Articles