You are here: Re: New lines to <br> « PHP Programming Language « IT news, forums, messages
Re: New lines to <br>

Posted by Lars Eighner on 10/08/07 09:11

In our last episode,
<1191833792.306121.298110@19g2000hsx.googlegroups.com>,
the lovely and talented Defacta
broadcast on comp.lang.php:

> Hello !

> How to delete all the new lines and replace them by <br>, because new
> lines involves Javacript Error, IE:

> facts_infos[0][1] = "In 1972 he was done for murdering a colleague
> over a matter of $30! <br />
> He served 2 years for this and was never seen again, blah blah blah."

> What I do is:
> nl2br($row['facts_content']))

> This add a <br /> but does not delete the new line before "He served".

Exactly as the manual describes nl2br. You did read the manual, didn't you?

> Does anyone know how to replace new lines to <br> tags and delete new
> lines \n ?

I guess you will have to settle for the obvious way: str_replace.

RTFM.

--
Lars Eighner <http://larseighner.com/> <http://myspace.com/larseighner>
Countdown: 470 days to go.
What do you do when you're debranded?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация