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

PHP除开空格函数

WBOY
Release: 2016-06-13 13:03:13
Original
852 people have browsed it

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

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template