转载自: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);
}

 

相关文章:

  • 2022-02-24
  • 2022-12-23
  • 2021-05-16
  • 2022-02-09
  • 2022-03-10
  • 2022-12-23
  • 2021-12-11
  • 2021-07-13
猜你喜欢
  • 2022-12-23
  • 2021-10-22
  • 2021-05-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案