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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.