johnwall Posted April 1, 2011 Share Posted April 1, 2011 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 https://forums.phpfreaks.com/topic/232411-include-euro-symbol-in-a-string/ Share on other sites More sharing options...
Nudd Posted April 1, 2011 Share Posted April 1, 2011 Use the html character code: € or € That should do it. Link to comment https://forums.phpfreaks.com/topic/232411-include-euro-symbol-in-a-string/#findComment-1195550 Share on other sites More sharing options...
johnwall Posted April 4, 2011 Author Share Posted April 4, 2011 Hi, Sorry should have mentioned that this string I create is passed using PHPExcel to a spreadsheet, in the cell the HTML code of the euro symbol appears instead of the symbol itself. Rgds Chris Link to comment https://forums.phpfreaks.com/topic/232411-include-euro-symbol-in-a-string/#findComment-1196555 Share on other sites More sharing options...
BluB Posted April 5, 2011 Share Posted April 5, 2011 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 https://forums.phpfreaks.com/topic/232411-include-euro-symbol-in-a-string/#findComment-1197074 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.