I use this only once, so putting it in a function is overkill imo.
I totally do not second that. The intent of your code is anything but obvious and you would make your code way more readable - and hence maintainable - if you put the line in a method
function remove_all_tags($string)
{
return strip_tags(utf8_decode(html_entity_decode(str_replace(["\r\n\r\n", "<br />", "<br>", "</p>"], "\r\n", $string), ENT_QUOTES)));
}
I'd furthermore suggest to separate the calls to make the intent clearer
function remove_all_tags($string)
{
$stringWithUnifiedNewline = str_replace(["\r\n\r\n", "<br />", "<br>", "</p>"], "\r\n", $string);
$htmlDecodedString = html_entity_decode($stringWithUnifiedNewline, ENT_QUOTES)
$utf8DecodedString = utf8_decode($htmlDecodedString);
return strip_tags($utf8DecodedString);
}
Now compare your original code
$string = strip_tags(utf8_decode(html_entity_decode(str_replace(["\r\n\r\n", "<br />", "<br>", "</p>"], "\r\n", $string), ENT_QUOTES)));
to
$string = remove_all_tags($string);
Your intent is clearer, the code cleaner and everyone's happy.