wordwrap(string,width,break,cut)
参数
描述
string
必需。规定要进行折行的字符串。
width
可选。规定最大行宽度。默认是 75。
break
可选。规定作为分隔符使用的字符(字串断开字符)。默认是 "\n"。
cut
可选。规定是否对大约指定宽度的单词进行折行。默认是 FALSE (no-wrap)。
例子 1<?php
$str = "An example on a long word is: Supercalifragulistic";
echo wordwrap($str,15);
?>
浏览器输出:
An example on a long word is: Supercalifragulistic
HTML 源代码:<html>
<html>
<body>
An example on a
long word is:
Supercalifragulistic
</body>
</html>
例子 2<?php
$str = "An example on a long word is: Supercalifragulistic";
echo wordwrap($str,15,"<br />\n");
?>
输出:
An example on a long word is: Supercalifragulistic