Replace CRLF with <BR>

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jojo2020
Forum Newbie
Posts: 4
Joined: Sun Jul 20, 2003 5:44 pm
Location: USA

Replace CRLF with <BR>

Post by jojo2020 »

I am pulling 'body' text from a table to use in a template and I don't want to have to type the <br> in the actual table text. I would like to handle replacing the CRLF as its pulled from the table and before its put into template. I am trying

$body=eregi_replace("\r\n","<br>",$body);

but the \r\n is where I am screwing up. Can anyone show the correct way to do this?

Thanks---
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

jojo2020
Forum Newbie
Posts: 4
Joined: Sun Jul 20, 2003 5:44 pm
Location: USA

Post by jojo2020 »

yrpG
Post Reply