Home  >  Article  >  Backend Development  >  php正则表达 去除非数字

php正则表达 去除非数字

WBOY
WBOYOriginal
2016-06-13 13:26:49742browse

求一个php正则表达 去除非数字
求一个正则额 去除非数字 比如:
"a1asd2asd3a"
正则过滤后 输出
123

不要intval()或者(int)之类的 因为大于10位数就不行了
谁先回复正确 分送你

------解决方案--------------------
echo preg_replace('/\D/','','a1asd2asd3a');

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