note 23549 deleted from function.wordwrap by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 09:03:21 +0000 |
| Subject: | note 23549 deleted from function.wordwrap by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196862@lists.php.net to get a copy of this message | ||
Note Submitter: warwallace at [nospam]wargardens dot com
----
It is also possible to consider this function as a tool for making text wrappable rather than simply
for forcing wrapping.
In other words, use a space as the break - rather than "br /" or "p" or \n or
whatever - and the text becomes wrappable.
<?php
$input = "I want to annoy you by inserting long wooooooooooooooooooooooooooooooooorrrrrrdddss
into your guestbook.";
$output = wordwrap($input, 40, ' ', 1);
?>
Will insert spaces into the words longer than 40 characters make the text wrappable by the browser.