I have run into a strange problem. I am trying to trim a string using php trim()
, but it is not working.
Here is my code
echo $deal->{self::DEAL_BUSINESS};
echo '<br>';
echo trim($deal->{self::DEAL_BUSINESS});
echo '<br>';
And here is the output
Alkaram Studio
Alkaram Studio
If it is not clear from the output. There is a space in the beginning of both untrimmed and the trimmed string.
In the view source I got this.
Alkaram Studio
Try the following:
echo trim($deal->{self::DEAL_BUSINESS}, "\xC2\xA0\n");
Or
$text = preg_replace('~\x{00a0}~siu','',$deal->{self::DEAL_BUSINESS});
echo $text;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With