note 10498 added to String functions
| From: | rze at counter-strike dot net | Date: | Sun, 07 Jan 2001 21:47:06 +0000 |
| Subject: | note 10498 added to String functions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9457@lists.php.net to get a copy of this message | ||
Here's some of my code for inserting spaces so people can't screw the page, I have not
tested it, but it's cleaner than other's.
list ($words) = array (split (" ", $comment));
$comment = '';
foreach ($words as $c => $word) {
if (strlen ($word) > 60 and !ereg ("[\[|\]|\/\/]", $word))
$word = chunk_split ($word, 60);
if ($c)
$comment .= ' ';
$comment .= $word;
}
http://www.php.net/manual/ref.strings.php