这篇文章主要为大家详细介绍了php 使用wordwrap按照用户指定长度进行换行,具有一定的参考价值,可以用来参考一下。
本范例演示了php中wordwrap如何按照用户指定的长度进行换行,感兴趣的小伙伴,下面一起跟随四海网的小编罗X来看看吧。
/**
* wordwrap如何按照用户指定的长度进行换行
*
* @param
* @arrange (512.笔记) www.q1010.com
**/
// create a long text for testing:
$long_text = 'This is a long text to demonstrate the usage of the ';
$long_text .= 'wordwrap function. ';
$long_text .= 'Fooooooooooooooooobar, just fooling around';
// syntax: wordwrap(input string, line max. width, break chars, cut words)
$new_text = wordwrap($long_text, 15, "<br/>\n", true);
print $new_text;
/*
The output will be:
This is a long<br/>
text to<br/>
demonstrate the<br/>
usage of the<br/>
wordwrap<br/>
function.<br/>
Foooooooooooooo<br/>
ooobar, just<br/>
fooling around
*/
/*** 代码来自四海网(www.q1010.com) ***/
本文来自:http://www.q1010.com/173/370-0.html
注:关于php 使用wordwrap按照用户指定长度进行换行的内容就先介绍到这里,更多相关文章的可以留意四海网的其他信息。
关键词:Wordwrap
四海网收集整理一些常用的php代码,JS代码,数据库mysql等技术文章。