Is there any way that I can get o identify characters like(trademark, superscripts, numbers) from text or text file(but these characters are't in HTML code) and replace them using php

Example:

Get from text: ™ replace with PHP: (TM)

有帮助吗?

解决方案

Yes, just parse your strings with str_replace.

Note that str_replace can use arrays, so you can replace multiple strings at once:

$text = "Text™®";
$text = str_replace(['™', '®'], ['(TM)', '(R)'], $text);
print $text;
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top