Convert dollar sign

Hi,

is there a standard function to properly convert $ to $ and any other signs like the euro etc…???

You might need to give more information there, and did you mean to type “convert $ to $”? What are you actually trying to do (in more detail)?


Sorry I really meant converting "$" to "#&36;"
Currently when a user type $3000, I store the value to my database as $3000. When I retrieve the result and output to a html page, the result becomes 000 show in the page, not sure why? But if I change the dollar sign to something like this in my database #&36;3000, the output shows correctly as $3000.

Sitepoint seems to have some bugs on displaying the $ and

#&36;

<– I have to use the CODE tag :frowning:

I’ve never had a problem putting $ directly in html.
Maybe [fphp]htmlentities[/fphp] will help?

Strangely I’ve encountered this on every of my past projects and I’m getting quite annoyed by this. Seems like a FireFox issue. htmlspecial and entities can’t convert though. :injured:

But then again might not be browser issue as it doesn’t affect here…testing: $4,000
Maybe it could be my html encoding.

You might want to check the encoding type of everything (the PHP script, database, web server header, HTML charset meta tag) to make sure they are consistent. UTF-8 without BOM is generally recommended.

If you have a conflict it might cause the wonky character.

Hey guys thanks for your help! Went through a debugging war deep to the core and found out its from a preg_replace function from my template engine. :(:(:frowning:

Thanks cranial.

Glad it’s sorted out.