-2

I need to Remove first < p> tag and replace the second

tag with < /br>

For example : I have a string '< p>Lorem Ipsum< /p>< p>is simply dummy< /p>'

I need the result as

Lorem Ipsum< br />is simply dummy

prasanth prem
  • 454
  • 3
  • 13

1 Answers1

0

Maybe something like this?

$input = '<p>Lorem Ipsum</p><p>is simply dummy</p>';

$output = nl2br(trim(str_replace(array("<p>","</p>"),array("","\n"),$input)));

Example: http://3v4l.org/Kmhkh

JoeCoder
  • 870
  • 5
  • 4