php 给段落添加空格的简单示例

对php给每个段落添加空格的代码感兴趣的小伙伴,下面一起跟随编程之家 jb51.cc的小编两巴掌来看看吧!

/**
 * php给每个段落添加空格的代码
 *
 * @param 
 * @arrange 512-笔记网: jb51.cc
 **/
//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 ) );
}
/***   来自编程之家 jb51.cc(jb51.cc)   ***/

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...