Jump to content

Include Euro symbol in a string


johnwall

Recommended Posts

Hi,

 

I am pulling a couple of  fields from a DB and I am assigned them all to one string, how can I include the € (euro synbol) in my string. I have something like

 

$test = "Hello ".$name."you have €".$balance

 

I am unable to create the € as normal using ctrl+alt+4, must I use somehting else?

 

Rgds

Chris

Link to comment
Share on other sites

Hey,

 

Either this:

 

$data=str_replace(chr(0xC2).chr(0x80) , chr(0xE2).chr(0x82).chr(0xAC), utf8_encode("Hello ".$name."you have €".$balance") );

 

Or this:

 

$data=str_replace(chr(0xC2).chr(0x80) , chr(0xE2).chr(0x82).chr(0xAC), "Hello " . $name . "you have €" . $balance);

 

Should work, depending on whether your data is already UTF-8 encoded or not.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.