手机
当前位置:查字典教程网 >编程开发 >php教程 >php给每个段落添加空格的方法
php给每个段落添加空格的方法
摘要:本文实例讲述了php给每个段落添加空格的方法。分享给大家供大家参考。具体实现方法如下:$text){$string[$line]=$whit...

本文实例讲述了php给每个段落添加空格的方法。分享给大家供大家参考。具体实现方法如下:

<?php //Prepends whitespace to each line of a string function white_space( $string, $whitespace ) { //Create an array from the string, each key having one line $string = explode( PHP_EOL, $string ); //Loop through the array and prepend the whitespace foreach( $string as $line => $text ) { $string[ $line ] = $whitespace . $text; } //Return the string return( implode( PHP_EOL, $string ) ); } ?>

希望本文所述对大家的php程序设计有所帮助。

【php给每个段落添加空格的方法】相关文章:

php实现将上传word文件转为html的方法

PHP调用三种数据库的方法(1)

php采集中国代理服务器网的方法

php遍历类中包含的所有元素的方法

PHP调用三种数据库的方法(3)

php中smarty实现多模版网站的方法

php函数重载的替代方法

php生成图片缩略图的方法

php统计数组元素个数的方法

php调整服务器时间的方法

精品推荐
分类导航