Hello, I need to pull out the content out of two paragraph tags and break it with a <br />
tag. The input is like so
<p>
Yay
</p>
<p>
StackOverFlow
</p>
It needs to be like
<p>
Yay <br />
StackOverflow
</p>
What I have so far is <p><?php preg_match('/<p>(.*)<\/p>/', $content, $match); echo($match[1])."..."; ?></p>
Which pulls the first paragraph tag only:
<p>
Yay...
</p>
Also, is it possible to set a character limit? A max of 40 characters for example from both of the paragraphs or would I have to use substr
?
Thanks!
So it turned out to be:
<?php $content = preg_replace('/<\/p>\s*<p>/', '<br/>', $content); echo substr("$content",0,180)."..."; ?>