Currency symbol is not displaying properly. Below is my code:
$total = "₮50.40";
echo $total."<br>"; //output: ₮50.40
$str3 = substr($total, 0, 1);
echo $str3; //output: �
The variable $total
is displaying correctly. But I extracted the symbol from $total
and display it, unfortunately it shows � .
I want to display ₮ from variable $total
.
I tried utf8
encoding, but no luck.
The ₮
character is a multi-byte character, so you need to use mb_substr
, not substr
:
$total = "₮50.40";
$str3 = mb_substr($total, 0, 1);
echo $str3;
Output:
₮