Preg_replace

7 posts by 3 authors in: Forums > CMS Builder
Last Post: September 24, 2013   (RSS)

I am trying to replace </p> with <br /> in specific content. I am using the following code :

<?php echo preg_replace('</p>', '<br />', $articlesRecord['content']); ?>

It works in that is puts the correct spacing in but adds the < > into the content. See attached screenshot.

Can you help me figure what I am missing or doing wrong?

Thanks!

April

Attachments:

contenttags.jpg 641K

My suggestion ;-)

<?php echo string_ireplace( '</p>', '<br />', $articlesRecord['content']); ?>

---



Peace and Long Life

Sorry, that doesn't work, that gives me an error on page.

That should work you need to show a before and after to give me a little bit if a hint.

---



Peace and Long Life

Here is the error I get:

Fatal error: Call to undefined function string_ireplace() in C:\inetpub\carolinaparent\newarticlemain.php on line 234

My page is attached.

Thanks so much!

Attachments:

newarticlemain.php 19K

Thanks Jason!

That is perfect, exactly what I needed!

April