|
|
|
// Algorithm contributed by Jouni Ahto: <jah@guru.cultnet.fi>.
Function fillParagraphs($text, $wrap=80, $break="\n"){
$paragraphs = split("\n+", "$text\n");
for ($i = 0; $i < sizeof($paragraphs); $i++) {
$paragraphs[$i] .= " ";
// must have trailing space for the regex to work
$paragraphs[$i] = ereg_replace("(.{0,$wrap}) +", "\\1$break", $paragraphs
[$i]);
}
return implode("", $paragraphs);
}
|
|
| The Porter Word Stemming Algorithm in PHP
Reduces words to their base stem for search engines and indexing Categories : Algorithms, PHP, Strings | | | textwrap fill-paragraph Categories : Strings, PHP, Algorithms | | | Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET Categories : Algorithms, HTML and PHP, PHP, Variables | | | mysql_escape_string Categories : PHP, MySQL, Databases, Strings | | | 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 | | | Allows you to parse a deliniated string and put the individual fields in a SELECT option in a form Categories : HTML, PHP, Strings | | | 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 | | | Adding dashes to credit card numbers Categories : Strings, Credit Cards, PHP | | | Boolean Keyword Interpreter Categories : PHP, Algorithms, Search Engines | | | Diffusion-Limited Aggregation visualization Categories : PHP, Graphics, Algorithms, Math. | | | Customizable encoding and decoding strings with security. Categories : PHP, Strings, HTML and PHP | | | I need a trim function/regexp that will trim all " " from the ends of a string. Categories : Regexps, PHP, Strings | | | Printer friendly pages from anywhere on a website. Categories : PHP, Strings, Content Management | | | Look for the *position* of the first occurence of string2
in string1, beginning at position start.
Categories : Complete Programs, PHP, Strings | | | Mimic ASP's GetString function with PHP Categories : PHP, Databases, MySQL, Strings | |
|
|
|