Do you know how to replace html tags with a space character using php?
If I display
strip_tags(\'Foo
bar\');
I helped my self with example from user40521, but I made a function with same api like php's strip_tags, it does not use multiple variables, and it also makes a trim, so a single whitespace is removed from start / end.
/**
* @param string $string
* @param string|null $allowable_tags
* @return string
*/
function strip_tags_with_whitespace($string, $allowable_tags = null)
{
$string = str_replace('<', ' <', $string);
$string = strip_tags($string, $allowable_tags);
$string = str_replace(' ', ' ', $string);
$string = trim($string);
return $string;
}