Reputation: 308
I am removing the first character of the string and I am using substr(); function for that.
For example :
<?php
$amount = '€300';
echo substr($amount ,1);
?>
This code is doing its work fine but it have some bug. When I display the substr() function applied string then it display something other symbol at the beginning of the string. Below image has output.
In above image you can see its displaying unwanted symbol. But when I apply substr() function again it works successfull.
I just want to know why this function having that symbol? what does this symbol mean? Why its coming in the output?
Upvotes: 2
Views: 3614
Reputation: 774
you could using mb_substr()
php function
http://php.net/manual/en/function.mb-substr.php
<?php
$amount = '€300';
echo mb_substr($amount, 1, NULL, "UTF-8");
?>
Upvotes: 2
Reputation: 99051
I managed to solve the problem by using utf8_decode
, i.e.:
$amount = utf8_decode('€300');
echo substr($amount ,1);
//300
Upvotes: 1