Home  >  Article  >  Backend Development  >  PHP除开空格函数

PHP除开空格函数

WBOY
WBOYOriginal
2016-06-13 13:03:13789browse

PHP去除空格函数
来自PHPCHINA的。。感觉比较好,收藏下..

$content = '注意这里是空格" "这里是&_nbsp;的空格" "这里是全角空格“ ”还有Unicode字符(类似中文)的空格“ ”';
var_dump($content);
echo '<br />';
$content = preg_replace("/(\s|\&nbsp\;| |\xc2\xa0)/","",$content);
var_dump($content);

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