PHP Questions Home | Register | Login
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website
Unanswered

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

How do I convert newlines to HTML line break tags?


To do this use the nl2br function - just pass it the string that contains the newlines and it'll do the rest for you, e.g.

$infowithbrs = nl2br("this\nhas\nline\nbreaks");

echo "$infowithbrs";

Comment on this Question and Answer >>>

ASK A QUESTION

More strings PHP Questions

7 Using regular expressions check for the validity of entered email-id. The @ symbol should not appear more than once. The dot (.) can appear at the most once before @ and at the most twice or at least once after @ symbol. The substring before @

How do I join strings together?

How do I remove space from the start of a PHP string?

How do I replace a word in a string in PHP?

How can I repeat a string several times?



Custom Search