Question

In my database, some products have a ™ symbol next to them. This is recorded in the database by ™. However when I echo this out from the database, it literally prints out ™ instead of the actual ™ symbol.

Any ideas on how I can avoid this and get it to actually display the symbol?

Was it helpful?

Solution

May be this can work for you try replacing &trade with the code mentioned by @wild.

$string = "™ here is a string";
$search = "™";
$replace =  '&#0153';
echo str_replace($search, $replace, $string);

OTHER TIPS

use this code where you want to print TM

echo '&#0153';
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top