Question

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)

Was it helpful?

Solution

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;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top