note 80423 deleted from function.wordwrap by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 18:29:02 +0000 |
| Subject: | note 80423 deleted from function.wordwrap by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155122@lists.php.net to get a copy of this message | ||
Note Submitter: me at me dot com
----
<?php
#for those who don't like word-wrap
function ($string, $max_length) {
$a_string = explode(" ",$string);
foreach ($a_string as $value)
{
if (strlen($value) > $max_length)
{
$length = strlen($value);
$repeats = $length / $max_length;
for ($i=0; $i<$repeats; $i++)
{
$str = substr ($value,($i*$max_length),$max_length);
print "<font color=red>".$str."</font><br />";
}
} else {
print $value."<br />";
}
}
}
?>