note 104960 added to function.wordwrap
| From: | perrycs at msn dot com | Date: | Tue, 19 Jul 2011 05:55:19 +0000 |
| Subject: | note 104960 added to function.wordwrap | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-181681@lists.php.net to get a copy of this message | ||
I notice a lot of people writing functions below to split long non broken words like
ahahahahahahahahahahahaha and I didn't see anyone mention one of the built in parts to this
function called CUT!
(from the main article at the top)
If the cut is set to TRUE, the string is always wrapped at or before the specified width. So if you
have a word that is larger than the given width, it is broken apart. (See second example).
<?php
$text = "A very long woooooooooooord.";
$newtext = wordwrap($text, 8, "\n", true);
echo "$newtext\n";
?>
Produces:
A very
long
wooooooo
ooooord.
Just thought I would re-point that out since no-one seems to be using it... just writing their own
routines to do something built in. Maybe I'm missing something, I'm still kinda new to
PHP (so far I love it).
----
Server IP: 69.147.83.197
Probable Submitter: 209.197.169.77
----
Manual Page -- http://www.php.net/manual/en/function.wordwrap.php
Edit -- https://master.php.net/note/edit/104960
Del: integrated -- https://master.php.net/note/delete/104960/integrated
Del: useless -- https://master.php.net/note/delete/104960/useless
Del: bad code -- https://master.php.net/note/delete/104960/bad+code
Del: spam -- https://master.php.net/note/delete/104960/spam
Del: non-english -- https://master.php.net/note/delete/104960/non-english
Del: in docs -- https://master.php.net/note/delete/104960/in+docs
Del: other reasons-- https://master.php.net/note/delete/104960
Reject -- https://master.php.net/note/reject/104960
Search -- https://master.php.net/manage/user-notes.php