This should do what you want:
If text only contains paragraphs
$string = "<p>Here some text
another line</p>
<p>Another paragraph
another line</p>";
$output = '';
$paragraphs = array_filter(explode("</p>", $string));
foreach ($paragraphs as $block) {
$output .= str_replace(array("\r", "\n"), '', $block);
}
var_dump($output); //<p>Here some textanother line</p><p>Another paragraphanother line</p>
If text contains multiple tags
$string = "<p>Here some text
another line</p>
<img src=\"/path/to/file.jpg\";
<div id=\"test\">
<p>Another paragraph
another line</p>
</div>";
preg_match_all('~<p>(.+?)</p>~si', $string, $paragraphs);
foreach ($paragraphs[0] as $block) {
$output = '';
if (strlen($block)) {
$output = str_replace(array("\r","\n"), '', $block);
$string = str_replace($block, $output, $string);
}
}