Reputation: 1550
I want to move some char eg.(/,\,/t..etc) from mysql result. Can I strip every char with one function? I want to know this function.Help me!
Upvotes: 0
Views: 143
Reputation: 75704
You can replace the occurences with the empty string, str_replace()
allows you to do multiple replace operations at once:
$string = str_replace(array("\t", '/', '\\'), '', $string);
Upvotes: 2
Reputation: 132254
To remove a set of characters from a string:
function removeBadCharacters($input) {
// removes '/', '\\' '\t'
return preg_replace("@[".preg_quote("/\\\t", '@')."]@g", '', $input);
}
Upvotes: 0