astralaaron Posted November 10, 2008 Share Posted November 10, 2008 I want to force a word wrap like this:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Link to comment Share on other sites More sharing options...
Synook Posted November 10, 2008 Share Posted November 10, 2008 You can force a break after a certain amount of characters with a regular expression. There is also a CSS property but it is not well-implemented. preg_replace("/([^\s]{100})([^\s])/i", "$1 $2", $string); Link to comment Share on other sites More sharing options...
Ingolme Posted November 10, 2008 Share Posted November 10, 2008 There's already a pre-existing PHP function for it: http://php.net/wordwrapIt's used like this: <?php$text = "The quick brown fox jumped over the lazy dog.";$newtext = wordwrap($text, 20, "<br />\n");echo $newtext;?> Which outputs The quick brown fox<br />jumped over the lazy<br />dog. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.