I this post we will show to remove some character in a specific string, we will write a php function to remove spaces from a string, we will use the php function str_replace() which replaces all occurrences of the search string with the replacement string.

function remove_spaces($str)
{
return str_replace( ‘  ‘, ” , $str);
}