PHP中英文字符串处理函数

分享到:

PHP中英文字符串处理函数

/**
* @see nl2br() – Inserts HTML line breaks before all newlines in a string
* @chunk_split() – 将字符串分割成小块
*/
string wordwrap ( string $str [, int $width=75 [, string $break="n" [, bool $cut=false ]]] )
Example #1 wordwrap() example
$text = “The quick brown fox jumped over the lazy dog.”;
$newtext = wordwrap($text, 20, ”
n”);
echo $newtext;
?>
上例将输出:
The quick brown fox
jumped over the lazy
dog.

/**
* 返回单词组成的数组
*/
mixed str_word_count ( string $string [, int $format=0 [, string $charlist ]] )

除非注明,干草博客文章均为原创,转载请以链接形式标明本文地址

本文地址:http://www.tmper.com/blog/string-handling-functions-in-english/