Jump to content

How do I add line breaks?


sprintlife

Recommended Posts

Hi guys,

 

How would I add line breaks in a line of text?

 

For example I get line of code like this "THE TEXT THE TEXT THE TEXT THE TEXT THE TEXT THE TEXT THE TEXT THE TEXT"

 

and I wanna add a line break after every 8 characters like this. So basically add a /n or <br> after each 8 characters.

"THE TEXT

THE TEXT

THE TEXT

THE TEXT

THE TEXT

THE TEXT

THE TEXT

THE TEXT"

Link to comment
https://forums.phpfreaks.com/topic/128956-how-do-i-add-line-breaks/
Share on other sites

No way that's how it's done?  Wow...  This is what I am working with http://www.joaomak.net/util/dtr/.  I want to be able to do word warp in images.  So would it work Zenag?

 

$text="THE TEXT THE TEXT THE TEXT THE TEXT THE TEXT THE TEXT THE TEXT THE TEXT";
echo wordwrap($text,8,"<br />\n");

No way that's how it's done?  Wow...  This is what I am working with http://www.joaomak.net/util/dtr/.  I want to be able to do word warp in images.  So would it work Zenag?

 

$text="THE TEXT THE TEXT THE TEXT THE TEXT THE TEXT THE TEXT THE TEXT THE TEXT";
echo wordwrap($text,8,"
\n");

 

It should work, I don't see why not.  Test it....

It will work for that specific example...generally not the best way to go.

 

I agree.  Different designs/circumstances call for different solutions.  If this works for you then go ahead, but if you would explain your situation then maybe we could give you a better solution  :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.