PHP removing commas, stops, questionmarks... from string -
this question has answer here:
let's have string this:
$string = "i have big, nice, green house!?"
what want remove characters ', . ! ? : "" ''' string.
how this? tryed rtrim() function, able remove 1 kind of characters not of them.
use str_replace()
array of special character -
$string = "i have big, nice, green house!?"; echo $content = str_replace(['.', ',', '?', '!'], '', $string);
output
i have big nice green house
or if want remove of them try regex
-
echo $content = preg_replace('/[^a-z0-9\s]/i', '', $string);
Comments
Post a Comment