I expected this code:
define('EURO_SIMBOLO', chr(128));
$euro = EURO_SIMBOLO;
var_dump($euro);
to show the €
symbol, but it doesn't. Why does this happen?
This will only work if you're using a 125x code page. The fact is that the euro character is not included in all extended ASCII character sets (introduced in ISO/IEC 8859-15), however it does have a de-facto Unicode character.
If this is simply for displaying in a browser, consider using either '€'
or '€'
If you are using such a character set with the euro-symbol you’re most likely using iso-8859-15 in which the '€' character is defined at position 164. So you might have more luck if you replace 128 by 164, although this won’t help you in utf-8 environments in which the previous answer might be more suited.
In the CP1252 encoding of € has the code 128; In ISO-8859-15 the code is 164; Macintosh Roman is 219;
The euro sign is a part of the ASCII. Look that http://www.ascii-code.com/