You can break lines according to the number of words per line you specify, which is more convenient and useful.
// text_wrap( $text, $max_width, $html_type )
// $text What to format
// $max_width - the length of the format
// $ html_type format
Function text_wrap( $text, $max_width, $html_type )
{
// $cnt keeps track of the position of t
// he last break
$cnt = 0;
if (!strcmp("PRE", $html_type))
$line_break = "n";
else
$line_break = "
n";
echo "n";
for ($i = $max_width; $i {
$width = $max_width;
while ($text[$i] != && $text[$i] != n && $text[i] != t)
{
$i--;
$width--;
}
echo substr($text, $cnt, $width),$line_break;
$cnt = $i+1;
}
$last_line = substr($text, $ cnt);
if ($last_line[0] != )
echo substr($text, $cnt);
else
echo substr($text, $cnt+1);
echo "$html_type>n";
}
// The following is a test, you can save this article and try it
$line = ""When considering the use of a server side" ;