1. Evaluate the length, the most basic
$ Text = "Sunny Day ";
$ COUNT = strlen ($ text); // $ COUNT = 9
2 string Truncation
Number of characters before Truncation
$ Article = "Breaking news: In Ultimate irony, man bites dog."; $ summary = substr_replace ($ article, "...", 40 );
3 count words
$ Article = "Breaking news: In Ultimate irony, man bites dog."; $ wordcount = str_word_count ($ article );
// $ Wordcount = 8
4. convert a string into an HTML connection
$ Url = "W. J. Gilmore, LLC (http://www.wjgilmore.com )";
$ Url = preg_replace ("/http: // ([A-z0-9 ../-] +)/", "$0", $ URL );
5 remove the HTML string from the character
$ Text = strip_tags ($ input ,"
");
6 nl2br:
$ Comment = nl2br ($ comment );
Changed to HTML Format
7 wordwrap
Limit the number of words per line
$ Speech = "Four score and seven years ago our fathers brought forth, upon this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal. ";
Echo wordwrap ($ speech, 30 );
Output:
Four score and seven years ago our fathers brought forth, upon this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.