转载自:http://www.phpernote.com/php-function/633.html
/**
* 多个连续空格只保留一个
*
* @param string $string 待转换的字符串
* @return string $string 转换后的字符串
*/
function merge_spaces($string){
return preg_replace("/\s(?=\s)/","\\1",$string);
}
转载自:http://www.phpernote.com/php-function/633.html
/**
* 多个连续空格只保留一个
*
* @param string $string 待转换的字符串
* @return string $string 转换后的字符串
*/
function merge_spaces($string){
return preg_replace("/\s(?=\s)/","\\1",$string);
}