note 23549 modified in function.wordwrap by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 18:38:51 +0000 |
| Subject: | note 23549 modified in function.wordwrap by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155158@lists.php.net to get a copy of this message | ||
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.
--was--
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.
$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.
http://php.net/manual/en/function.wordwrap.php