1 Seeking length, the most basic
$text = "Sunny Day";
$count = strlen ($text); $count = 9
2 string interception
The number of characters before interception
$article = "Breaking news:in ultimate irony, man bites dog."; $summary = Substr_replace ($article, "...", 40);
3 Count The number of words
$article = "Breaking news:in ultimate irony, man bites dog."; $wordCount = Str_word_count ($article);
$wordCount = 8
4 Connect a string into HTML
$url = "W.J. Gilmore, LLC (http://www.jb51.net)";
$url = Preg_replace ("/http://([a-z0-9./-]+)/", "$", $url);
5 Removing HTML strings from characters
$text = Strip_tags ($input, "
");
6 NL2BR:
$comment = NL2BR ($comment);
into HTML format
7 WordWrap
Limit the number of words per line
$speech = "Four score and seven years ago we fathers brought forth, upon this continent, a new nation, conceived in Liber Ty, and dedicated to the proposition, all men is created equal. ";
Echo WordWrap ($speech, 30);
Output:
Four score and seven years ago we fathers brought forth, upon this continent, a new nation, conceived in Liberty, and ded Icated to the proposition, all men is created equal.
http://www.bkjia.com/PHPjc/321986.html www.bkjia.com true http://www.bkjia.com/PHPjc/321986.html techarticle 1 for length, the most basic $text = "Sunny Day"; $count = strlen ($text);//$count = 9 2 string intercept the number of characters before interception $article = "Breaking news:in u Ltimate irony, man b ...