I have a string(retrieved from another website using cURL. With the string I am trying to replace a certain character with nothing, no space, just get rid of it.
foreach($propinfo_desc_div as $child)
{
// ONLY SHOW STRINGS LONGER THAN 10 CHARS
$strlen = strlen($child->nodeValue);
if($strlen > 10)
{
$description = str_replace(htmlspecialchars('Â'),'', $child->nodeValue);
echo $description;
echo "<br />";
}
}
Some info on the character:
ASCII Code: 'Â';string example:
fully serviced daily. Â Â Spend the evenings relaxing in the frie
Solution by @Whoughton
<meta http-equiv="content-type" content="text/html; charset=utf-8">
Ok, I spent a little more time looking at it, I believe this should work a little better:
$char = utf8_decode('this is a string with char in it  couple of times');
$r = utf8_decode('Â');
$upd = str_replace($r, '', $char);
This produces, for me:
Source: string(51) "this is a string with char in it  couple of times"
Function: str_replace('Â', '', $char)
Output: string(49) "this is a string with char in it couple of times"
Old answer removed...
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