Home  >  Article  >  类库下载  >  PHP filters multiple spaces into one space preg_replace filters multiple spaces

PHP filters multiple spaces into one space preg_replace filters multiple spaces

高洛峰
高洛峰Original
2016-10-14 10:41:051365browse

preg_replace filters multiple spaces

$text = "ooo    我是   空格";
$text = preg_replace("/(\s+)/",' ',$text);
echo $text;


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

Related articles

See more