Home  >  Article  >  php教程  >  php 合并字符串中连续空格

php 合并字符串中连续空格

WBOY
WBOYOriginal
2016-06-21 08:49:071086browse

php 实现清除文本字符串或html字符串中的多个连续空格的方法,具体代码如下:

/**
function 合并多个连续空格
*/
function merge_spaces($string){
	return str_replace(array(' ',' '),'',$string);
}



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn