I have a variable, lets say $peoplename, that have dynamic output for example or like you see, sometime there is characther in the output, i want to replace that character in the output, please help what is looks like the right replacement code, this should be easy enough, already tried this but its looks like still not right
i think you want something like html_entity_decode Check it here.. http://www.php.net/manual/en/function.html-entity-decode.php
Your problem is in the usage of str_replace. Here is how the php manual says to use it (http://php.net/manual/en/function.str-replace.php) mixed str_replace ( mixed $search , mixed $replace , mixed $subject [, int &$count ] ) PHP: Your code should look like this. $peoplename = 'michael '; $nbsp = ' '; $peoplenamereplaced = str_replace($nbsp, '', $peoplename); echo $peoplenamereplaced; PHP: