php 正则轮换

WBOY
WBOYOriginal
2016-06-13 11:11:17888browse

php 正则替换
某个字符串,希望把非字母和数字的之外的都替换掉。
比如$tname="d#$(,)123"  过滤完成以后 应该是:$tname="d123"


------解决方案--------------------
echo preg_replace('/[^a-z0-9]+/i','',$tname);
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