|
|
|
<?php
function wraptext($text,$warp) {
$text = explode(" ", $text);
$i = 0; $length = 0;
while ($i <= count($text)) {
$length += strlen($text[$i]);
if ($length <= $warp) {
$output .= $text[$i]." ";
$i++;
} else {
$output .= "\n";
$length = 0;
}
}
return $output;
}
// Usage :
// =======
// $text = "very long text";
// $forhtml = nl2br(wraptext($text,72));
// echo $forhtml;
// $formail = mail($email,$subject,wraptext($text,72));
?> |
|
| function textwrap will wrap text to any desired width using <BR>\n as the default line break.
Default wrap width is 80 columns.
Categories : Strings, HTML and PHP, PHP | | | Customizable encoding and decoding strings with security. Categories : PHP, Strings, HTML and PHP | | | Pull deliniated text strings into a "SELECT" statement in a form. Categories : HTML and PHP, PHP, Strings | | | Produces browser-safe strings while preserving HTML tags. Categories : Strings, HTTP, PHP, HTML and PHP | | | string justification align center text Categories : Strings, PHP, HTML and PHP | | | PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use! Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP | | | A simple class with some HTML output functions that would come in handy for consistent page layout etc. Categories : PHP, PHP Classes, HTML and PHP, HTML, Navigation | | | a function that builds an HTML select list from any mysql table. Categories : PHP, MySQL, HTML and PHP | | | Message of the Day - Random Message (Needs MySQL!) Categories : Databases, HTML and PHP, PHP, MySQL | | | Calendar using Date function Categories : HTML and PHP, PHP, Date Time, Calendar | | | Constantly refresh your PHP/HTML page data. Categories : PHP, HTML and PHP, Sybase | | | Avoiding or Detecting high bit characters in a string. Useful when you want to create a valid RSS feed Categories : PHP, Strings, Unicode, Regexps, Rich Site Summary (RSS) | | | Select with current month Categories : PHP, HTML and PHP, Date Time, Arrays | | | PHP4 session helper HTML file.
Categories : PHP, Java Script, HTML and PHP, Sessions | | | A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL | |
|
|
|