| | |
text comin back in one line
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
PHP Syntax (Toggle Plain Text)
<td width=""><p><?php echo wordwrap($message, 75, "<br />", true); ?></p></td>
•
•
Join Date: Jul 2008
Posts: 148
Reputation:
Solved Threads: 25
html Syntax (Toggle Plain Text)
<td width=""><p><?php echo nl2br(wordwrap($message, 75, PHP_EOL, true)); ?></p></td>
The wordwrap function breaks your content down with PHP_EOL which is a constant that is defined to match the proper end of line charachter for your operating system.
Then uses nl2br to convert them to <br>'s including any ones the user entered.
the only thing i caution is against using the last parameter of "true" as this will allow php to cut words in half instead of breaking at the nearest word break
![]() |
Other Threads in the PHP Forum
- Previous Thread: new member module....
- Next Thread: error
| Thread Tools | Search this Thread |
advanced apache api array beginner binary broken cakephp check checkbox class cms code cookies cron curl database date datepart display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google head href htaccess html if...loop image include includingmysecondfileinthechain insert ip javascript job joomla jquery key library limit link login mail menu mlm multiple mysql oop password paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote screen script search server sessions smarty sms sorting source space sql startup stored syntax system table traffic tutorial unicode update upload url validator variable video web youtube zend





